From 7258ffbd698fe7e0a12ae2b8cd19577750994996 Mon Sep 17 00:00:00 2001 From: "walyong.cho" Date: Wed, 22 Aug 2012 15:22:13 +0900 Subject: [PATCH] tizen 2.0 --- ChangeLog | 430 +++ INSTALL | 30 +- Makefile.am | 312 +- Makefile.in | 1151 +++--- NEWS | 152 + README | 74 +- TODO | 21 +- aclocal.m4 | 21 +- autogen.sh | 2 +- config.guess => build-aux/config.guess | 136 +- config.sub => build-aux/config.sub | 0 depcomp => build-aux/depcomp | 0 install-sh => build-aux/install-sh | 0 ltmain.sh => build-aux/ltmain.sh | 3968 +++++++++++++------- missing => build-aux/missing | 0 configure | 3542 +++++++++++------ configure.ac | 185 +- debian/changelog | 24 + debian/control | 4 +- extra/blacklist.conf | 24 - extra/create_static_nodes | 31 - extra/dsl-modem.agent | 102 - extra/fbdev-blacklist.conf | 25 - extra/firmware.agent | 35 - extra/hotplug.functions | 61 - extra/initramfs.bottom | 35 - extra/initramfs.hook | 72 - extra/initramfs.top | 34 - extra/links.conf | 15 - extra/logger.agent | 32 - extra/make-fbdev-blacklist | 26 - extra/net.agent | 105 - extra/subst_lib_name | 57 - extra/udev.base-installer | 7 - extra/udev.startup | 38 - extra/udev.vim | 45 - extras/accelerometer/61-accelerometer.rules | 3 + extras/accelerometer/accelerometer.c | 357 ++ extras/ata_id/ata_id.c | 27 +- extras/cdrom_id/60-cdrom_id.rules | 9 +- extras/cdrom_id/cdrom_id.c | 365 +- extras/collect/collect.c | 21 +- extras/firmware/firmware.c | 8 +- extras/fstab_import/79-fstab_import.rules | 2 - extras/fstab_import/fstab_import.c | 203 - extras/gudev/docs/Makefile.in | 193 +- extras/gudev/docs/gudev-docs.xml | 2 +- extras/gudev/docs/gudev-sections.txt | 19 + extras/gudev/docs/html/GUdevClient.html | 152 +- extras/gudev/docs/html/GUdevDevice.html | 371 +- extras/gudev/docs/html/GUdevEnumerator.html | 153 +- extras/gudev/docs/html/gudev-hierarchy.html | 10 +- extras/gudev/docs/html/gudev.devhelp | 75 - extras/gudev/docs/html/gudev.devhelp2 | 8 +- extras/gudev/docs/html/index.html | 16 +- extras/gudev/docs/html/index.sgml | 3 +- extras/gudev/docs/html/ix01.html | 18 +- extras/gudev/docs/html/ix02.html | 12 +- extras/gudev/docs/html/ref-API.html | 10 +- extras/gudev/docs/html/style.css | 3 +- extras/gudev/docs/tmpl/gudevenumtypes.sgml | 24 + extras/gudev/docs/tmpl/gudevmarshal.sgml | 24 + extras/gudev/docs/version.xml | 2 +- extras/gudev/gjs-example.js | 75 + extras/gudev/gudevclient.c | 2 + extras/gudev/gudevclient.h | 1 - extras/gudev/gudevdevice.h | 1 - extras/gudev/gudevenumerator.h | 1 - extras/gudev/seed-example-enum.js | 38 + extras/gudev/seed-example.js | 72 + extras/hid2hci/70-hid2hci.rules | 30 - extras/hid2hci/hid2hci.c | 350 -- extras/input_id/input_id.c | 184 - extras/keymap/95-keyboard-force-release.rules | 4 +- extras/keymap/95-keymap.rules | 21 +- extras/keymap/keymap.c | 53 +- extras/keymap/keymaps/acer-aspire_5920g | 3 +- extras/keymap/keymaps/dell-latitude-xt2 | 4 + extras/keymap/keymaps/genius-slimstar-320 | 35 + .../lenovo-thinkpad-usb-keyboard-trackpoint | 2 +- extras/keymap/keymaps/module-lenovo | 1 + extras/keymap/keymaps/olpc-xo | 38 +- .../61-mobile-action.rules | 15 - extras/mobile-action-modeswitch/ma8280p_us.c | 462 --- extras/mobile-action-modeswitch/ma8280p_us.h | 24 - .../mobile-action-modeswitch.c | 262 -- extras/mobile-action-modeswitch/utils.c | 83 - extras/mobile-action-modeswitch/utils.h | 32 - .../75-persistent-net-generator.rules | 2 + extras/rule_generator/rule_generator.functions | 8 +- extras/scsi_id/README | 4 + extras/scsi_id/scsi_id.c | 25 +- extras/scsi_id/scsi_serial.c | 12 +- .../udev-acl/{70-acl.rules => 70-udev-acl.rules} | 8 +- extras/udev-acl/udev-acl.c | 10 +- extras/v4l_id/60-persistent-v4l.rules | 4 +- extras/v4l_id/v4l_id.c | 15 - gtk-doc.make | 182 +- init/udev-control.socket | 8 + init/udev-kernel.socket | 9 + init/udev-retry.service.in | 10 - init/udev-settle.service.in | 17 +- init/udev-trigger.service.in | 10 + init/udev.service.in | 11 +- libudev/docs/Makefile.in | 193 +- libudev/docs/html/api-index-full.html | 36 +- libudev/docs/html/ch01.html | 13 +- libudev/docs/html/index.html | 15 +- libudev/docs/html/index.sgml | 10 +- libudev/docs/html/libudev-udev-device.html | 306 +- libudev/docs/html/libudev-udev-enumerate.html | 207 +- libudev/docs/html/libudev-udev-list.html | 59 +- libudev/docs/html/libudev-udev-monitor.html | 171 +- libudev/docs/html/libudev-udev-queue.html | 157 +- libudev/docs/html/libudev-udev-util.html | 88 + libudev/docs/html/libudev-udev.html | 123 +- libudev/docs/html/libudev.devhelp | 106 - libudev/docs/html/libudev.devhelp2 | 7 +- libudev/docs/html/style.css | 3 +- libudev/docs/libudev-docs.xml | 3 +- libudev/docs/libudev-sections.txt | 10 +- libudev/docs/tmpl/libudev-device.sgml | 19 + libudev/docs/tmpl/libudev-enumerate.sgml | 10 + libudev/docs/tmpl/libudev-queue.sgml | 9 - libudev/docs/tmpl/libudev-util.sgml | 35 + libudev/docs/tmpl/libudev.sgml | 11 +- libudev/docs/version.xml | 2 +- libudev/exported_symbols | 82 - libudev/libudev-ctrl.c | 320 -- libudev/libudev-device-private.c | 17 +- libudev/libudev-device.c | 853 +++-- libudev/libudev-enumerate.c | 341 +- libudev/libudev-list.c | 231 +- libudev/libudev-monitor.c | 157 +- libudev/libudev-private.h | 97 +- libudev/libudev-queue-private.c | 80 +- libudev/libudev-queue.c | 87 +- libudev/libudev-util-private.c | 246 +- libudev/libudev-util.c | 31 +- libudev/libudev.c | 156 +- libudev/libudev.h | 15 +- libudev/test-libudev.c | 90 +- m4/gtk-doc.m4 | 6 + m4/libtool.m4 | 2009 ++++++---- m4/ltoptions.m4 | 13 +- m4/ltversion.m4 | 12 +- m4/lt~obsolete.m4 | 12 +- packaging/start_udev | 0 packaging/udev-80-drivers.patch | 61 + packaging/udev-firmware.patch | 38 + packaging/udev-hotplug.patch | 65 + packaging/udev.init | 319 -- packaging/udev.spec | 106 +- packaging/udev.udev-mtab.init | 52 - rules/debian/50-udev-default.rules | 100 - rules/debian/60-persistent-storage-tape.rules | 41 - rules/debian/60-persistent-storage.rules | 149 - rules/debian/75-cd-aliases-generator.rules | 11 - rules/debian/75-persistent-net-generator.rules | 116 - rules/debian/80-drivers.rules | 58 - rules/debian/91-permissions.rules | 124 - rules/misc/30-kernel-compat.rules | 92 +- rules/rules.d/50-udev-default.rules | 17 +- rules/rules.d/60-persistent-alsa.rules | 9 +- rules/rules.d/60-persistent-input.rules | 9 +- rules/rules.d/60-persistent-serial.rules | 18 +- rules/rules.d/60-persistent-storage-tape.rules | 9 +- rules/rules.d/60-persistent-storage.rules | 28 +- rules/rules.d/75-net-description.rules | 2 +- rules/rules.d/75-tty-description.rules | 2 +- rules/rules.d/78-sound-card.rules | 10 +- rules/rules.d/80-drivers.rules | 1 - test/rule-syntax-check.py | 6 +- test/udev-test.pl | 19 +- udev/sd-daemon.c | 112 +- udev/sd-daemon.h | 50 +- udev/test-udev.c | 61 +- udev/udev-builtin-input_id.c | 218 ++ .../path_id.c => udev/udev-builtin-path_id.c | 241 +- .../usb_id/usb_id.c => udev/udev-builtin-usb_id.c | 289 +- udev/udev-builtin.c | 76 + udev/udev-ctrl.c | 494 +++ udev/udev-event.c | 450 ++- udev/udev-node.c | 35 +- udev/udev-rules.c | 1217 +++--- udev/udev-watch.c | 10 +- udev/udev.7 | 125 +- udev/udev.h | 106 +- udev/udev.html | 168 +- udev/udev.xml | 184 +- udev/udevadm-control.c | 73 +- udev/udevadm-info.c | 227 +- udev/udevadm-monitor.c | 138 +- udev/udevadm-settle.c | 142 +- udev/udevadm-test-builtin.c | 123 + udev/udevadm-test.c | 76 +- udev/udevadm-trigger.c | 57 +- udev/udevadm.8 | 55 +- udev/udevadm.c | 114 +- udev/udevadm.html | 23 +- udev/udevadm.xml | 50 +- udev/udevd.8 | 15 +- udev/udevd.c | 918 +++-- udev/udevd.html | 8 +- 204 files changed, 15692 insertions(+), 13087 deletions(-) rename config.guess => build-aux/config.guess (92%) rename config.sub => build-aux/config.sub (100%) rename depcomp => build-aux/depcomp (100%) rename install-sh => build-aux/install-sh (100%) rename ltmain.sh => build-aux/ltmain.sh (68%) rename missing => build-aux/missing (100%) delete mode 100644 extra/blacklist.conf delete mode 100644 extra/create_static_nodes delete mode 100644 extra/dsl-modem.agent delete mode 100644 extra/fbdev-blacklist.conf delete mode 100644 extra/firmware.agent delete mode 100644 extra/hotplug.functions delete mode 100644 extra/initramfs.bottom delete mode 100644 extra/initramfs.hook delete mode 100644 extra/initramfs.top delete mode 100644 extra/links.conf delete mode 100644 extra/logger.agent delete mode 100644 extra/make-fbdev-blacklist delete mode 100644 extra/net.agent delete mode 100644 extra/subst_lib_name delete mode 100644 extra/udev.base-installer delete mode 100644 extra/udev.startup delete mode 100644 extra/udev.vim create mode 100644 extras/accelerometer/61-accelerometer.rules create mode 100644 extras/accelerometer/accelerometer.c delete mode 100644 extras/fstab_import/79-fstab_import.rules delete mode 100644 extras/fstab_import/fstab_import.c delete mode 100644 extras/gudev/docs/html/gudev.devhelp create mode 100644 extras/gudev/docs/tmpl/gudevenumtypes.sgml create mode 100644 extras/gudev/docs/tmpl/gudevmarshal.sgml create mode 100755 extras/gudev/gjs-example.js create mode 100755 extras/gudev/seed-example-enum.js create mode 100755 extras/gudev/seed-example.js delete mode 100644 extras/hid2hci/70-hid2hci.rules delete mode 100644 extras/hid2hci/hid2hci.c delete mode 100644 extras/input_id/input_id.c create mode 100644 extras/keymap/keymaps/dell-latitude-xt2 create mode 100644 extras/keymap/keymaps/genius-slimstar-320 delete mode 100644 extras/mobile-action-modeswitch/61-mobile-action.rules delete mode 100644 extras/mobile-action-modeswitch/ma8280p_us.c delete mode 100644 extras/mobile-action-modeswitch/ma8280p_us.h delete mode 100644 extras/mobile-action-modeswitch/mobile-action-modeswitch.c delete mode 100644 extras/mobile-action-modeswitch/utils.c delete mode 100644 extras/mobile-action-modeswitch/utils.h create mode 100644 extras/scsi_id/README rename extras/udev-acl/{70-acl.rules => 70-udev-acl.rules} (89%) create mode 100644 init/udev-control.socket create mode 100644 init/udev-kernel.socket delete mode 100644 init/udev-retry.service.in create mode 100644 init/udev-trigger.service.in create mode 100644 libudev/docs/html/libudev-udev-util.html delete mode 100644 libudev/docs/html/libudev.devhelp create mode 100644 libudev/docs/tmpl/libudev-util.sgml delete mode 100644 libudev/exported_symbols delete mode 100644 libudev/libudev-ctrl.c mode change 100644 => 100755 packaging/start_udev create mode 100755 packaging/udev-80-drivers.patch create mode 100755 packaging/udev-firmware.patch create mode 100755 packaging/udev-hotplug.patch delete mode 100644 packaging/udev.init mode change 100644 => 100755 packaging/udev.spec delete mode 100644 packaging/udev.udev-mtab.init delete mode 100644 rules/debian/50-udev-default.rules delete mode 100644 rules/debian/60-persistent-storage-tape.rules delete mode 100644 rules/debian/60-persistent-storage.rules delete mode 100644 rules/debian/75-cd-aliases-generator.rules delete mode 100644 rules/debian/75-persistent-net-generator.rules delete mode 100644 rules/debian/80-drivers.rules delete mode 100644 rules/debian/91-permissions.rules create mode 100644 udev/udev-builtin-input_id.c rename extras/path_id/path_id.c => udev/udev-builtin-path_id.c (73%) rename extras/usb_id/usb_id.c => udev/udev-builtin-usb_id.c (65%) create mode 100644 udev/udev-builtin.c create mode 100644 udev/udev-ctrl.c create mode 100644 udev/udevadm-test-builtin.c diff --git a/ChangeLog b/ChangeLog index 1b8caab..ed5bb13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,433 @@ +Summary of changes from v173 to v174 +============================================ + +David Zeuthen (1): + ata_id: Check for Compact Flash card + +Jerone Young (1): + Add mic mute keycode support for Lenovo Thinkpad USB keyboard + +Kay Sievers (34): + gtk-doc: delete empty files + libudev: list - use binary search for list lookup + rules: move input_id to default rules + implement path_id, usb_id, input_id as built-in command + do not remove static nodes on module unload + rules: remove legacy rules for cdrom and usb printer + update TODO + preserve 'sticky bit' on 'add/change' events + libudev: util_get_sys_(subsystem,driver}() -> util_get_sys_core_link_value() + export USEC_INITIALIZED= and take timestamp on message receive time + libudev: udev_device_get_sysattr_value() return syspath of custom links + libudev: list - properly sort linked list not only the index + mknod: do not complain about existing node + update README + libudev: fix typo in documentation + rules: fuse: do not mount fusectl from udev rules + keymap: add genius keymap to Makefile + update NEWS + usb_id: can't use global variables when used as built-in + remove 'udevadm trigger --type=failed' and SYSFS, ID, BUS keys + libudev: export udev_util_encode_string() + update TODO + systemd: no not start udev in a container + systemd: no not start udev in a container + delete left-over files in extras/ + systemd: update drop-in sd-daemon files + udevadm: control - use /run/udev/control socket instead of abstract namespace one + udevd: control - no not delete socket file when --daemon is used + udev_ctrl_cleanup()- accept NULL as argument + update NEWS + udevd: install into /lib/udev instead of /sbin + udevd: add missing braces + systemd: use ConditionCapability=CAP_MKNOD instead of ConditionVirtualization=!container + rules: do not load sg module + +Kir Kolyshkin (1): + keymap: add Genius SlimStar 320 + +Martin Pitt (1): + keymap: Update Acer Aspire 5920g + +Matthias Clasen (1): + make: allow to pass ${ACLOCAL_FLAGS} + +Paul Fox (1): + keymap: update the OLPC keymap for correct function key behavior + +Petr Uzel (1): + udevadm: settle - return failure if unknown option is given + +Steve Langasek (1): + udevd: exit - process events before signals in worker + +Thomas Hood (2): + keymap: Support keymap overrides in /etc/udev/keymaps + keymap: Support for microphone mute button on ThinkPad X220 et al + + +Summary of changes from v172 to v173 +============================================ + +Allin Cottrell (1): + configure: allow to disable mtd_probe + +Kay Sievers (15): + make: fix 'make tar-sync' + udevd: use 'uptime' in debug timestamp + udevd: fix (recently) broken static node permission setting + rules: mount fuse filesystem only 'add' + udevadm: move udevadm command descriptions into their files + udev-acl: skip ACLs when systemd is running, disable by default + do not delete database when renaming netif, the db name does not change anymore + do not allow kernel properties to be set by udev rules + configure: reorder options + rules: input - do not create (broken) links for bluetooth devices + rules: serial - do not export ID_PORT, use ID_USB_INTERFACE_NUM + rules: sound - instead of ID_IFACE use standard ID_USB_INTERFACE_NUM + keymap: do not run usb_id for bluetooth devices + udevadm: trigger --type=failed - log deprecation warning + udevd: debug - put timestamp in [] + +Martin Pitt (4): + gudev: Ship JavaScript examples + scsi_id: Ship README + Remove obsolete extras/scsi_id/scsi_id.config + keymap: Only run on key devices + + +Summary of changes from v171 to v172 +============================================ + +Bastien Nocera (3): + accelerometer: add orientation property + udev-acl: fix memleak + accelerometer: add documentation + +Harald Hoyer (2): + udevadm-*.c: return != 0, if unknown option given + udev/udevadm-monitor.c: fixed misplaced brace + +Kay Sievers (33): + rules: apply 'audio' group of the static snd/{seq,timer} nodes + Makefile: add tar-sync + rules: static_node - use 0660 if group is given to get the cigar + rule-syntax-check.py: use print() + make: use 'git tag' + rules: run input_id for main input devices too + update TODO + configure: add AC_CONFIG_AUX_DIR, AC_CONFIG_SRCDIR + cdrom_id: add tray lock and eject handling + rules: enable in-kernel media-presence polling + update TODO + delete mobile-action-modeswitch which has moved to usb_modeswitch + libudev: enumerate - scan /sys/module + rules: move polling rule above 'block' match + libudev: monitor - update doc + rules: set polling value only if it is disabled + libudev: device - fix udev_device_get_tags_list_entry() to always load database + rules: remove redundant MODE="0664" from lp rules + rules: fix wrong wildcard match, we always need a ':*' at the end + libudev: device - export udev_device_has_tag() + path_id: add missing '-' to tape suffix + path_id: add ID_PATH_TAG= to be used in udev tags + enforce valid TAG+= names + update TODO + libudev: device - add udev_device_has_tag() to libudev.h and gtk-doc + libudev: enumerate - add udev_enumerate_add_match_parent() + libudev: enumerate - include parent device itself with match_parent() + libudev: enumerate - clarify documentation + path_id: recognize ACPI parent devices + rules: input - call path_id for ACPI devices + udevadm: monitor - use uptime to match the kernel's timestamp + libudev: ctrl - move code to udev directory + update sd-daemon.[ch] + +Keshav P.R (1): + rules: support for gpt partition uuid/label + +Lee, Chun-Yi (1): + Support more MSI notebook by using asterisk on dmi vendor name + +Marco d'Itri (1): + Add missing commas to 95-keymap.rules + +Martin Pitt (3): + keymap: Add Microsoft Natural Keyboard + keymap: Add force-release quirk for Hannspree SN10. + keymap: Add slight name variations of Toshiba Satellites + +Peter Jones (1): + ata_id: show the error message when HDIO_GET_IDENTITY fails + + +Summary of changes from v170 to v171 +============================================ + +Kay Sievers (17): + libudev: export symbols explicitely and individually from C code not from separate file or prefix match + libudev: device - make a bunch of symbols static + systemd: Replace Requires= with Wants=, run trigger in parallel + systemd: sort trigger after socket + systemd: trigger - run after udev.service (for now) + systemd: set socket buffer size to 128 MB like udev has + update TODO + update TODO + libudev: monitor - use SOCK_NONBLOCK + systemd: split socket file + systemd: add missing socket files + rules: fix whitespace + rules: implement TAGS== match + libudev: enumerate - do not ignore other matches when add_match_tag() is used + rules: support substitutions in TAG= + path_id: allow to be asked about usb_devices not only usb_interfaces + systemd: run udev.service and udev-trigger.service in parallel + +Scott James Remnant (1): + configure: allow usb.ids location to be specified + + +Summary of changes from v169 to v170 +============================================ + +Kay Sievers (1): + libudev: ctrl - properly wait for incoming message after connect + +Michal Soltys (1): + configure.ac: fixes for rule_generator and modeswitch + + +Summary of changes from v168 to v169 +============================================ + +Kay Sievers (26): + simplify rules file overwrite logic + libudev: list - use bit flags for 'sort' and 'unique' + libudev: queue - _unref() should return the object + remove dead fstab_import files + hid2hci: prepare move to bluez package + set event timeout to 60 sec and settle timeout to 120 + udevd: improve error message in case exec() fails + configure: allow to enable/disable extras individually + delete hid2hci which moved to the bluez tree + update TODO/NEWS + bump requirement to Linux kernel 2.6.32 and ARM 2.6.36 + libudev: ctrl - log accept4() errors + update NEWS + update INSTALL, NEWS, configure comment, queue doc + update TODO + udevd: create queue file before daemonizing to reliably block 'settle' + udevd: remove left-over SIGALRM + gudev: silent gtk-doc warnings + cdrom_id: remove unused --export switch to silent gcc + libudev: queue - always rebuild queue file when nothing is queued anymore + libudev: device - use DEVMODE from kernel as the default mode + update TODO + Merge branch 'docs/udev.xml' of git://github.com/mfwitten/udev + udate TODO, NEWS, INSTALL + build: use --gc-sections, -fvisibility=hidden + udevadm: settle: wake up more often if --seq-start= or --exit-if-exists= is used + +Koen Kooi (1): + configure: reintroduce introspection flags to fix crosscompilation + +Michael Witten (36): + Docs: udev.xml: Offset daemon name with commas + Docs: udev.xml: Remove commas (and unnecessary repetition) + Docs: udev.xml: `are' -> `is'; the subject is `Access' + Docs: udev.xml: Use present tense + Docs: udev.xml: Clarification through proper wording + Docs: udev.xml: `,' -> `;' + Docs: udev.xml: `key value' -> `key-value' + Docs: udev.xml: `,' -> `:' + Docs: udev.xml: Use `assignment' consistently + Docs: udev.xml: `comma-separated' is a better description + Docs: udev.xml: Remove unnecessary repitition + Docs: udev.xml: Add a few more words for context + Docs: udev.xml: Use `unless' for clarity + Docs: udev.xml: Clarify PROGRAM key + Docs: udev.xml: `a shell style' -> `shell-style' + Docs: udev.xml: Clean `*' description + Docs: udev.xml: Clean character range description + Docs: udev.xml: Clean up description of NAME assignment key + Docs: udev.xml: Clean up description of SYMLINK assignment key + Docs: udev.xml: Clean up description of ENV assignment key + Docs: udev.xml: Clean up description of RUN assignment key + Docs: udev.xml: Clean up description of LABEL assignment key + Docs: udev.xml: Add missing `.' + Docs: udev.xml: `which' -> `content of which' + Docs: udev.xml: `commandline' -> `command line' + Docs: udev.xml: Clean up WAIT_FOR description + Docs: udev.xml: `a' -> `the' + Docs: udev.xml: Clean up introduction to substitutions. + Docs: udev.xml: Use normal sentence structure + Docs: udev.xml: Actually make a separate paragraph + Docs: udev.xml: Add comma + Docs: udev.xml: `char' -> `character' + Docs: udev.xml: `comma-separated' is a better description + Docs: udev.xml: Clarify through a change in word ordering + Docs: udev.xml: Improved word order + Docs: udev.xml: Fix dangling modifier + +Nix (1): + libudev: queue - accept NULL passed into udev_queue_export_cleanup() + + +Summary of changes from v167 to v168 +============================================ + +David Zeuthen (1): + Run ata_id on non-removable USB devices + +Harald Hoyer (1): + udevd: clarify worker exit status + +Kay Sievers (35): + version bump + systemd: let settle depend on trigger, do not block basic with trigger + selinux: do not label files in runtime dir + selinux: firmware - do not label files in runtime dir + udevadm: control - add --exit + trivial cleanups + udevd: log warning if /run is not writable + libudev: ctrl - fix refcounting in connection handling + udevadm: settle - watch queue file + libudev: bump revision + udevadm: info --cleanup-db + udevd: do not nice processes + "db_persist=" -> "db_persist" + udevd: move OOM disable into --daemon option + systemd: add OOMScoreAdjust=-1000 + require explicit "db_persist" to exclude device info from --db-cleanup + udevd: get netlink socket from systemd + fix more warnings + libudev: ctrl, monitor - use SOCK_NONBLOCK + systemd: socket -> sockets + udevadm: monitor - use epoll + libudev: test - use epoll + udevadm: test - use printf() instead of info() for non-debug output + use 'else if' in epoll event array loop + libudev: run_program() - select() -> epoll + udevd: ppoll() -> epoll + signalfd + Merge branch 'docs/README' of git://github.com/mfwitten/udev + timeout handling without alarm() + udevadm: settle - kill alarm() + udevd: netif rename - use ifindex for temporary name + udevd: always use udevd[] log prefix + udevd: rules files - accept empty or /dev/null links + udevd: log signal number when spawned processes fail + systemd: Reqires= -> Wants=udev.socket + udevd, udev-event: sync waitpid() error handling + +Lee, Chun-Yi (1): + Add rule for Acer Aspire One ZG8 to use acer-aspire_5720 keymap + +Leonid Antonenkov (1): + rule-generator: net - ignore Hyper-V virtual interfaces + +Martin Pitt (3): + Revert "Do not build extras with --disable-extras" + Avoid spinning up CD on pressing eject button + keymap: Another ID for Logitech Wave keyboard + +Michael Reed (1): + path_id: rework SAS device handling + +Michael Witten (12): + Docs: README: `to replace' -> `replacing' + Docs: README: `,' -> `;' + Docs: README: Clean up a sentence + Docs: README: Use present tense + Docs: README: Add missing `and' + Docs: README: Remove commas and use subjective mood + Docs: README: Clean up `udev extras' requirements + Docs: README: Clarify configuration of existing devices + Docs: README: `does never apply' -> `never applies' + Docs: README: Flip sentence structure to improve wording + Docs: README: `set up' is the verb; `setup' is a noun + Docs: README: Add a comma to offset the modifier + +Seth Forshee (1): + keymap: Support Dell Latitude XT2 tablet-mode navigation keys + +Thomas Egerer (1): + udevd: add 'N:' to optstring in getopt_long + + +Summary of changes from v166 to v167 +============================================ + +Andrey Borzenkov (1): + udev-acl: add /dev/sgX nodes for CD-ROM + +David Zeuthen (1): + cdrom_id: Don't ignore profiles when there is no media available + +Harald Hoyer (2): + cdrom_id: cd_media_toc() extend toc size to 65536 + udev-acl/70-acl.rules: tag ID_REMOTE_CONTROL with acl + +Kay Sievers (29): + version bump + Merge branch 'master' of git+ssh://master.kernel.org/pub/scm/linux/hotplug/udev + v4l_id: kill the v4l1 ioctl + v4l_id: remove left-over variable + update some comments + test-libudev: add short options + libudev: udev_device_get_sysattr_list_entry() update + libudev: resolve ifindex in udev_device_new_from_id_filename() + libudev: bump minor version + udev-acl: move sg rule to optical drive rule + move /dev/.udev/ to /dev/.run/udev/ and convert old udev database at udevd startup + NEWS: clarify /dev/.run/ requirements + input_id: silent gcc warnings + fstab_import: disable build + systemd: remove deprecated udev-retry.service + fstab_import: remove from configure + update sd-daemon.[ch] + udevd: use facility == LOG_DAEMON when writing to /dev/kmsg + udevd: initialize fds, for proper close() on exit + use /run/udev/ if possible and fall back to /dev/.udev/ + rules: run ata_id only on SPC-3 or later optical drives + systemd: bind udev control socket in systemd and split udev.service + systemd: use sockets.target not socket.target + man: remove trigger --type=failed handling + libudev: export udev_get_run_path() + libudev: docs - add udev_get_run_path() + libudev: make valgrind happy + systemd: do not enable udev-settle.service by default + systemd: udev.socket - disable implicit dependencies + +Kei Tokunaga (1): + udevadm: enumerate - update prev pointer properly + +Lee, Chun-Yi (2): + Remap Acer WMI touchpad toggle key to F21 used by X + Remap MSI Laptop touchpad on/off key to F22 and F23 + +Martin Pitt (12): + 60-persistent-input.rules: Support multiple interfaces + Only build v4l_id if V4L1 header file is available + 60-persistent-input.rules: Do not create duplicate links + Fix building with --disable-extras + Do not build extras with --disable-extras + v4l_id: Drop videodev.h check again + keymap: Fix Acer Aspire 5920G media key + input_id: Consistently use tabs for indentation + input_id: Add some debugging output + input_id: Avoid memory overflow with too long capability masks + input_id: Cover key devices which only have KEY_* > 255 + input_id: Rewrite debug logging to use standard udev info() + +Seth Forshee (1): + keymap: continue reading keymap after invalid scancodes + +Thomas Egerer (3): + libudev: allow to get list of all available sysfs attrs for a device + libudev: use sysfs attr ilist interface for attribute walk + udevadm: info - make attribute array static and const + + Summary of changes from v165 to v166 ============================================ diff --git a/INSTALL b/INSTALL index 02ad55f..943a8a4 100644 --- a/INSTALL +++ b/INSTALL @@ -8,29 +8,6 @@ Usual options for udev installed in the root filesystem are: --libexecdir=/lib/udev \ --with-selinux -All options: - --prefix= - Usually /usr, prefix for man pages, include files. - --sysconfdir= - Usually /etc. - --sbindir= - Usually /sbin, the place for udevd and udevadm. - --libexecdir= - Usually /lib/udev, the udev private directory. - --enable-debug - Compile-in verbose debug messages. Usually not needed, - it increases the size of the binaries. - --disable-logging - Disable all logging and compile-out all log strings. This - is not recommended, as it makes it almost impossible to debug - udev in the running system. - --with-selinux - Link against SELinux libraries to set the expected context - for created files. - --disable-extras - Disable the build of all extras which have larger external - dependencies like glib, libacl, libusb, ... - The options used in a RPM spec file usually look like: %configure \ --prefix=%{_prefix} \ @@ -47,13 +24,12 @@ other location will break other packages, who rightfully expect the /lib/udev/ directory, to install their rule helper and udev rule files. -It is recommended to use the /lib/udev/devices/ directory to place +It is possible to use the /lib/udev/devices/ directory to place device nodes, directories and symlinks, which are copied to /dev/ at every bootup. That way, nodes for devices which can not be detected automatically, or are activated on-demand by opening the pre-existing device node, will be available. -Default udev rules and persistent device naming rules are required +Default udev rules and persistent device naming rules may be required by other software that depends on the data udev collects from the -devices, and should therefore be installed by default with every udev -installation. +devices. diff --git a/Makefile.am b/Makefile.am index df426f7..4dbd53c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,7 @@ SUBDIRS = . EXTRA_DIST = autogen.sh -ACLOCAL_AMFLAGS = -I m4 +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} AM_MAKEFLAGS = --no-print-directory @@ -17,7 +17,13 @@ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DLIBEXECDIR=\""$(libexecdir)"\" +AM_CFLAGS = \ + -fvisibility=hidden \ + -ffunction-sections \ + -fdata-sections + AM_LDFLAGS = \ + -Wl,--gc-sections \ -Wl,--as-needed DISTCHECK_CONFIGURE_FLAGS = \ @@ -25,18 +31,19 @@ DISTCHECK_CONFIGURE_FLAGS = \ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) CLEANFILES = - +BUILT_SOURCES = INSTALL_EXEC_HOOKS = INSTALL_DATA_HOOKS = UNINSTALL_EXEC_HOOKS = DISTCHECK_HOOKS = +dist_libexec_SCRIPTS = # ------------------------------------------------------------------------------ # libudev # ------------------------------------------------------------------------------ -LIBUDEV_CURRENT=10 +LIBUDEV_CURRENT=13 LIBUDEV_REVISION=0 -LIBUDEV_AGE=10 +LIBUDEV_AGE=13 SUBDIRS += libudev/docs @@ -54,15 +61,13 @@ libudev_libudev_la_SOURCES =\ libudev/libudev-queue.c libudev_libudev_la_LDFLAGS = \ - -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE) \ - -export-symbols $(top_srcdir)/libudev/exported_symbols + -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE) noinst_LTLIBRARIES = \ libudev/libudev-private.la libudev_libudev_private_la_SOURCES =\ $(libudev_libudev_la_SOURCES) \ - libudev/libudev-ctrl.c \ libudev/libudev-util-private.c \ libudev/libudev-device-private.c \ libudev/libudev-queue-private.c @@ -75,7 +80,7 @@ endif pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libudev/libudev.pc -EXTRA_DIST += libudev/exported_symbols libudev/COPYING +EXTRA_DIST += libudev/COPYING # move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed libudev-install-move-hook: if test "$(libdir)" != "$(rootlib_execdir)"; then \ @@ -124,29 +129,44 @@ sharepkgconfig_DATA = udev/udev.pc if WITH_SYSTEMD systemdsystemunit_DATA = \ + init/udev-control.socket \ + init/udev-kernel.socket \ init/udev.service \ - init/udev-settle.service \ - init/udev-retry.service + init/udev-trigger.service \ + init/udev-settle.service + +EXTRA_DIST += \ + init/udev-control.socket \ + init/udev-kernel.socket systemd-install-hook: + mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants + ln -sf ../udev-control.socket $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants/udev-control.socket + ln -sf ../udev-kernel.socket $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants/udev-kernel.socket mkdir -p $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants ln -sf ../udev.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev.service - ln -sf ../udev-settle.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev-settle.service - ln -sf ../udev-retry.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev-retry.service + ln -sf ../udev-trigger.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev-trigger.service INSTALL_DATA_HOOKS += systemd-install-hook endif sbin_PROGRAMS = \ - udev/udevd \ udev/udevadm +libexec_PROGRAMS = \ + udev/udevd + udev_common_sources =\ udev/udev.h \ udev/udev-event.c \ udev/udev-watch.c \ udev/udev-node.c \ - udev/udev-rules.c + udev/udev-rules.c \ + udev/udev-ctrl.c \ + udev/udev-builtin.c \ + udev/udev-builtin-path_id.c \ + udev/udev-builtin-usb_id.c \ + udev/udev-builtin-input_id.c udev_udevd_SOURCES = \ $(udev_common_sources) \ @@ -160,10 +180,11 @@ udev_udevadm_SOURCES = \ udev/udevadm.c \ udev/udevadm-info.c \ udev/udevadm-control.c \ - udev/udevadm-test.c \ udev/udevadm-monitor.c \ udev/udevadm-settle.c \ - udev/udevadm-trigger.c + udev/udevadm-trigger.c \ + udev/udevadm-test.c \ + udev/udevadm-test-builtin.c udev_udevadm_LDADD = libudev/libudev-private.la # ------------------------------------------------------------------------------ @@ -208,27 +229,13 @@ udev_test_udev_SOURCES = \ udev_test_udev_LDADD = libudev/libudev-private.la # ------------------------------------------------------------------------------ -# rule_generator - persistent network and optical device rule generator -# ------------------------------------------------------------------------------ -dist_libexec_SCRIPTS = \ - extras/rule_generator/write_cd_rules \ - extras/rule_generator/write_net_rules - -udevhomedir = $(libexecdir) -dist_udevhome_DATA = extras/rule_generator/rule_generator.functions - -dist_udevrules_DATA += \ - extras/rule_generator/75-cd-aliases-generator.rules \ - extras/rule_generator/75-persistent-net-generator.rules - -# ------------------------------------------------------------------------------ # firmware - firmware loading # ------------------------------------------------------------------------------ extras_firmware_firmware_SOURCES = extras/firmware/firmware.c extras_firmware_firmware_LDADD = libudev/libudev-private.la extras_firmware_firmware_CPPFLAGS = $(AM_CPPFLAGS) -DFIRMWARE_PATH="$(FIRMWARE_PATH)" dist_udevrules_DATA += extras/firmware/50-firmware.rules -libexec_PROGRAMS = extras/firmware/firmware +libexec_PROGRAMS += extras/firmware/firmware # ------------------------------------------------------------------------------ # ata_id - ATA identify @@ -253,44 +260,6 @@ extras_collect_collect_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/collect/collect # ------------------------------------------------------------------------------ -# edd_id - BIOS EDD block device match -# ------------------------------------------------------------------------------ -extras_edd_id_edd_id_SOURCES = extras/edd_id/edd_id.c -extras_edd_id_edd_id_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/edd_id/edd_id -dist_udevrules_DATA += extras/edd_id/61-persistent-storage-edd.rules - -# ------------------------------------------------------------------------------ -# create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) -# ------------------------------------------------------------------------------ -extras_floppy_create_floppy_devices_SOURCES = extras/floppy/create_floppy_devices.c -extras_floppy_create_floppy_devices_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/floppy/create_floppy_devices -dist_udevrules_DATA += extras/floppy/60-floppy.rules - -# ------------------------------------------------------------------------------ -# input_id - import input device class -# ------------------------------------------------------------------------------ -extras_input_id_input_id_SOURCES = extras/input_id/input_id.c -extras_input_id_input_id_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/input_id/input_id - -# ------------------------------------------------------------------------------ -# path_id - compose identifier of persistent elements of the parent buses -# ------------------------------------------------------------------------------ -extras_path_id_path_id_SOURCES = extras/path_id/path_id.c -extras_path_id_path_id_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/path_id/path_id - -# ------------------------------------------------------------------------------ -# fstab_import - import /etc/fstab entry for block device -# ------------------------------------------------------------------------------ -extras_fstab_import_fstab_import_SOURCES = extras/fstab_import/fstab_import.c -extras_fstab_import_fstab_import_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/fstab_import/fstab_import -dist_udevrules_DATA += extras/fstab_import/79-fstab_import.rules - -# ------------------------------------------------------------------------------ # scsi_id - SCSI inquiry to get various serial numbers # ------------------------------------------------------------------------------ extras_scsi_id_scsi_id_SOURCES =\ @@ -301,13 +270,7 @@ extras_scsi_id_scsi_id_SOURCES =\ extras_scsi_id_scsi_id_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/scsi_id/scsi_id dist_man_MANS += extras/scsi_id/scsi_id.8 - -# ------------------------------------------------------------------------------ -# usb_id - USB device property import -# ------------------------------------------------------------------------------ -extras_usb_id_usb_id_SOURCES = extras/usb_id/usb_id.c -extras_usb_id_usb_id_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/usb_id/usb_id +EXTRA_DIST += extras/scsi_id/README # ------------------------------------------------------------------------------ # v4l_id - video4linux capabilities @@ -318,19 +281,19 @@ libexec_PROGRAMS += extras/v4l_id/v4l_id dist_udevrules_DATA += extras/v4l_id/60-persistent-v4l.rules # ------------------------------------------------------------------------------ -# qemu -- qemu/kvm guest tweaks +# accelerometer - updates device orientation # ------------------------------------------------------------------------------ -dist_udevrules_DATA += extras/qemu/42-qemu-usb.rules +extras_accelerometer_accelerometer_SOURCES = extras/accelerometer/accelerometer.c +extras_accelerometer_accelerometer_LDADD = libudev/libudev-private.la -lm +libexec_PROGRAMS += extras/accelerometer/accelerometer +dist_udevrules_DATA += extras/accelerometer/61-accelerometer.rules -if ENABLE_EXTRAS # ------------------------------------------------------------------------------ -# conditional extras (need glib, libusb, libacl, ...) +# qemu -- qemu/kvm guest tweaks # ------------------------------------------------------------------------------ -dist_udevrules_DATA += \ - rules/rules.d/75-net-description.rules \ - rules/rules.d/75-tty-description.rules \ - rules/rules.d/78-sound-card.rules +dist_udevrules_DATA += extras/qemu/42-qemu-usb.rules +if ENABLE_GUDEV # ------------------------------------------------------------------------------ # GUdev - libudev gobject interface # ------------------------------------------------------------------------------ @@ -371,7 +334,7 @@ dist_extras_gudev_libgudev_1_0_la_SOURCES = \ extras/gudev/gudevmarshal.c \ extras/gudev/gudevenumtypes.h \ extras/gudev/gudevenumtypes.c -BUILT_SOURCES = $(dist_extras_gudev_libgudev_1_0_la_SOURCES) +BUILT_SOURCES += $(dist_extras_gudev_libgudev_1_0_la_SOURCES) extras_gudev_libgudev_1_0_la_CPPFLAGS = \ $(AM_CPPFLAGS) \ @@ -382,7 +345,11 @@ extras_gudev_libgudev_1_0_la_CPPFLAGS = \ -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \ -D_GUDEV_COMPILATION \ -DG_LOG_DOMAIN=\"GUdev\" -extras_gudev_libgudev_1_0_la_CFLAGS = $(GLIB_CFLAGS) + +extras_gudev_libgudev_1_0_la_CFLAGS = \ + -fvisibility=default \ + $(GLIB_CFLAGS) + extras_gudev_libgudev_1_0_la_LIBADD = libudev/libudev.la $(GLIB_LIBS) extras_gudev_libgudev_1_0_la_LDFLAGS = \ @@ -394,7 +361,10 @@ EXTRA_DIST += \ extras/gudev/COPYING \ extras/gudev/gudevmarshal.list \ extras/gudev/gudevenumtypes.h.template \ - extras/gudev/gudevenumtypes.c.template + extras/gudev/gudevenumtypes.c.template \ + extras/gudev/gjs-example.js \ + extras/gudev/seed-example-enum.js \ + extras/gudev/seed-example.js extras/gudev/gudevmarshal.h: extras/gudev/gudevmarshal.list $(AM_V_GEN)glib-genmarshal $< --prefix=g_udev_marshal --header > $@ @@ -412,20 +382,20 @@ extras/gudev/gudevenumtypes.c: extras/gudev/gudevenumtypes.c.template extras/gud $@.tmp && mv $@.tmp $@ if ENABLE_INTROSPECTION -extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefile.am - $(AM_V_GEN)PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ - LD_LIBRARY_PATH=$(top_builddir)/extras/gudev:$$LD_LIBRARY_PATH \ - $(G_IR_SCANNER) -v \ +extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) + $(AM_V_GEN)$(G_IR_SCANNER) -v \ + --warn-all \ --namespace GUdev \ --nsversion=1.0 \ --include=GObject-2.0 \ --library=gudev-1.0 \ - --library-path=extras/gudev \ + --library-path=$(top_builddir)/libudev \ + --library-path=$(top_builddir)/extras/gudev \ --output $@ \ --pkg=glib-2.0 \ --pkg=gobject-2.0 \ - -I$(top_builddir)/extras \ -I$(top_srcdir)/extras \ + -I$(top_builddir)/extras \ -D_GUDEV_COMPILATION \ -D_GUDEV_WORK_AROUND_DEV_T_BUG \ $(top_srcdir)/extras/gudev/gudev.h \ @@ -466,79 +436,28 @@ libgudev-uninstall-move-hook: INSTALL_EXEC_HOOKS += libgudev-install-move-hook UNINSTALL_EXEC_HOOKS += libgudev-uninstall-move-hook +endif +if ENABLE_HWDB # ------------------------------------------------------------------------------ -# Bluetooth HID devices with special magic to switch the device -# ------------------------------------------------------------------------------ -extras_hid2hci_hid2hci_SOURCES = extras/hid2hci/hid2hci.c -extras_hid2hci_hid2hci_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) -extras_hid2hci_hid2hci_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) -dist_udevrules_DATA += extras/hid2hci/70-hid2hci.rules -libexec_PROGRAMS += extras/hid2hci/hid2hci - -# ------------------------------------------------------------------------------ -# udev_acl - apply ACLs for users with local forground sessions -# ------------------------------------------------------------------------------ -extras_udev_acl_udev_acl_SOURCES = extras/udev-acl/udev-acl.c -extras_udev_acl_udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) -extras_udev_acl_udev_acl_LDADD = libudev/libudev-private.la -lacl $(GLIB_LIBS) -dist_udevrules_DATA += extras/udev-acl/70-acl.rules -libexec_PROGRAMS += extras/udev-acl/udev-acl - -udevacl-install-hook: - mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d - ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d/udev-acl.ck - -INSTALL_EXEC_HOOKS += udevacl-install-hook - -# ------------------------------------------------------------------------------ -# usb-db - read USB vendor/device string database +# usb/pci-db - read vendor/device string database # ------------------------------------------------------------------------------ extras_usb_db_usb_db_SOURCES = extras/usb-db/usb-db.c extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB extras_usb_db_usb_db_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/usb-db/usb-db +dist_udevrules_DATA += \ + rules/rules.d/75-net-description.rules \ + rules/rules.d/75-tty-description.rules \ + rules/rules.d/78-sound-card.rules -# ------------------------------------------------------------------------------ -# pci-db - read PCI vendor/device string database -# ------------------------------------------------------------------------------ extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI extras_usb_db_pci_db_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/usb-db/pci-db +endif -# ------------------------------------------------------------------------------ -# mobile-action-modeswitch - switch Mobile Action cables into serial mode -# ------------------------------------------------------------------------------ -extras_mobile_action_modeswitch_mobile_action_modeswitch_SOURCES =\ - extras/mobile-action-modeswitch/mobile-action-modeswitch.c \ - extras/mobile-action-modeswitch/utils.c \ - extras/mobile-action-modeswitch/utils.h \ - extras/mobile-action-modeswitch/ma8280p_us.c \ - extras/mobile-action-modeswitch/ma8280p_us.h -extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) -extras_mobile_action_modeswitch_mobile_action_modeswitch_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) - -dist_udevrules_DATA += \ - extras/mobile-action-modeswitch/61-mobile-action.rules - -libexec_PROGRAMS += extras/mobile-action-modeswitch/mobile-action-modeswitch - -# ------------------------------------------------------------------------------ -# mtd_probe - autoloads FTL module for mtd devices -# ------------------------------------------------------------------------------ -extras_mtd_probe_mtd_probe_SOURCES = \ - extras/mtd_probe/mtd_probe.c \ - extras/mtd_probe/mtd_probe.h \ - extras/mtd_probe/probe_smartmedia.c - -extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) - -dist_udevrules_DATA += extras/mtd_probe/75-probe_mtd.rules - -libexec_PROGRAMS += extras/mtd_probe/mtd_probe - - +if ENABLE_KEYMAP # ------------------------------------------------------------------------------ # keymap - map custom hardware's multimedia keys # ------------------------------------------------------------------------------ @@ -556,7 +475,6 @@ libexec_PROGRAMS += extras/keymap/keymap dist_libexec_SCRIPTS += extras/keymap/findkeyboards dist_libexec_SCRIPTS += extras/keymap/keyboard-force-release.sh dist_doc_DATA = extras/keymap/README.keymap.txt - CLEANFILES += \ extras/keymap/keys.txt \ extras/keymap/keys-from-name.gperf @@ -572,6 +490,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/asus \ extras/keymap/keymaps/compaq-e_evo \ extras/keymap/keymaps/dell \ + extras/keymap/keymaps/dell-latitude-xt2 \ extras/keymap/keymaps/everex-xt5000 \ extras/keymap/keymaps/fujitsu-amilo_pa_2548 \ extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 \ @@ -579,6 +498,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/fujitsu-amilo_si_1520 \ extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 \ extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 \ + extras/keymap/keymaps/genius-slimstar-320 \ extras/keymap/keymaps/hewlett-packard \ extras/keymap/keymaps/hewlett-packard-2510p_2530p \ extras/keymap/keymaps/hewlett-packard-compaq_elitebook \ @@ -641,8 +561,73 @@ extras/keymap/keys-to-name.h: extras/keymap/keys.txt Makefile keymaps-distcheck-hook: extras/keymap/keys.txt $(top_srcdir)/extras/keymap/check-keymaps.sh $(top_srcdir) $^ DISTCHECK_HOOKS += keymaps-distcheck-hook +endif + +if ENABLE_MTD_PROBE +# ------------------------------------------------------------------------------ +# mtd_probe - autoloads FTL module for mtd devices +# ------------------------------------------------------------------------------ +extras_mtd_probe_mtd_probe_SOURCES = \ + extras/mtd_probe/mtd_probe.c \ + extras/mtd_probe/mtd_probe.h \ + extras/mtd_probe/probe_smartmedia.c +extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) +dist_udevrules_DATA += extras/mtd_probe/75-probe_mtd.rules +libexec_PROGRAMS += extras/mtd_probe/mtd_probe +endif + +if ENABLE_RULE_GENERATOR +# ------------------------------------------------------------------------------ +# rule_generator - persistent network and optical device rule generator +# ------------------------------------------------------------------------------ +dist_libexec_SCRIPTS += \ + extras/rule_generator/write_cd_rules \ + extras/rule_generator/write_net_rules + +udevhomedir = $(libexecdir) +dist_udevhome_DATA = extras/rule_generator/rule_generator.functions + +dist_udevrules_DATA += \ + extras/rule_generator/75-cd-aliases-generator.rules \ + extras/rule_generator/75-persistent-net-generator.rules +endif + +if ENABLE_UDEV_ACL +# ------------------------------------------------------------------------------ +# udev_acl - apply ACLs for users with local forground sessions +# ------------------------------------------------------------------------------ +extras_udev_acl_udev_acl_SOURCES = extras/udev-acl/udev-acl.c +extras_udev_acl_udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) +extras_udev_acl_udev_acl_LDADD = libudev/libudev-private.la -lacl $(GLIB_LIBS) +dist_udevrules_DATA += extras/udev-acl/70-udev-acl.rules +libexec_PROGRAMS += extras/udev-acl/udev-acl + +udevacl-install-hook: + mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d + ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d/udev-acl.ck + +INSTALL_EXEC_HOOKS += udevacl-install-hook +endif + +if ENABLE_FLOPPY +# ------------------------------------------------------------------------------ +# create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) +# ------------------------------------------------------------------------------ +extras_floppy_create_floppy_devices_SOURCES = extras/floppy/create_floppy_devices.c +extras_floppy_create_floppy_devices_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/floppy/create_floppy_devices +dist_udevrules_DATA += extras/floppy/60-floppy.rules +endif -endif # ENABLE_EXTRAS +if ENABLE_EDD +# ------------------------------------------------------------------------------ +# edd_id - create /dev/disk/by-id/edd-* links for BIOS EDD data +# ------------------------------------------------------------------------------ +extras_edd_id_edd_id_SOURCES = extras/edd_id/edd_id.c +extras_edd_id_edd_id_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/edd_id/edd_id +dist_udevrules_DATA += extras/edd_id/61-persistent-storage-edd.rules +endif # ------------------------------------------------------------------------------ # install, uninstall, clean hooks @@ -694,9 +679,20 @@ git-release: head -1 ChangeLog | grep -q "to v$(VERSION)" head -1 NEWS | grep -q "udev $(VERSION)" git commit -a -m "release $(VERSION)" - cat .git/refs/heads/master > .git/refs/tags/$(VERSION) - git gc - git prune + git tag -m $(VERSION) -s $(VERSION) + git gc --prune=0 + +tar: + make distcheck + gpg --armor --detach-sign udev-$(VERSION).tar.gz + gpg --armor --detach-sign udev-$(VERSION).tar.bz2 + +git-sync: + git push + git push --tags $(VERSION) + +tar-sync: + scp udev-$(VERSION).tar.gz master.kernel.org:/pub/linux/utils/kernel/hotplug/ doc-sync: rsync -av udev/*.html master.kernel.org:/pub/linux/utils/kernel/hotplug/udev/ diff --git a/Makefile.in b/Makefile.in index 12a74f1..2b96593 100644 --- a/Makefile.in +++ b/Makefile.in @@ -44,77 +44,98 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @WITH_SELINUX_TRUE@am__append_1 = libudev/libudev-selinux-private.c -@WITH_SYSTEMD_TRUE@am__append_2 = systemd-install-hook -sbin_PROGRAMS = udev/udevd$(EXEEXT) udev/udevadm$(EXEEXT) -check_PROGRAMS = libudev/test-libudev$(EXEEXT) udev/test-udev$(EXEEXT) -libexec_PROGRAMS = extras/firmware/firmware$(EXEEXT) \ +@WITH_SYSTEMD_TRUE@am__append_2 = \ +@WITH_SYSTEMD_TRUE@ init/udev-control.socket \ +@WITH_SYSTEMD_TRUE@ init/udev-kernel.socket + +@WITH_SYSTEMD_TRUE@am__append_3 = systemd-install-hook +sbin_PROGRAMS = udev/udevadm$(EXEEXT) +libexec_PROGRAMS = udev/udevd$(EXEEXT) \ + extras/firmware/firmware$(EXEEXT) \ extras/ata_id/ata_id$(EXEEXT) \ extras/cdrom_id/cdrom_id$(EXEEXT) \ - extras/collect/collect$(EXEEXT) extras/edd_id/edd_id$(EXEEXT) \ - extras/floppy/create_floppy_devices$(EXEEXT) \ - extras/input_id/input_id$(EXEEXT) \ - extras/path_id/path_id$(EXEEXT) \ - extras/fstab_import/fstab_import$(EXEEXT) \ - extras/scsi_id/scsi_id$(EXEEXT) extras/usb_id/usb_id$(EXEEXT) \ - extras/v4l_id/v4l_id$(EXEEXT) $(am__EXEEXT_1) + extras/collect/collect$(EXEEXT) \ + extras/scsi_id/scsi_id$(EXEEXT) extras/v4l_id/v4l_id$(EXEEXT) \ + extras/accelerometer/accelerometer$(EXEEXT) $(am__EXEEXT_1) \ + $(am__EXEEXT_2) $(am__EXEEXT_3) $(am__EXEEXT_4) \ + $(am__EXEEXT_5) $(am__EXEEXT_6) +check_PROGRAMS = libudev/test-libudev$(EXEEXT) udev/test-udev$(EXEEXT) +@ENABLE_GUDEV_TRUE@am__append_4 = extras/gudev/docs +@ENABLE_GUDEV_TRUE@am__append_5 = extras/gudev/libgudev-1.0.la +@ENABLE_GUDEV_TRUE@am__append_6 = extras/gudev/gudev-1.0.pc +@ENABLE_GUDEV_TRUE@am__append_7 = $(dist_extras_gudev_libgudev_1_0_la_SOURCES) +@ENABLE_GUDEV_TRUE@am__append_8 = \ +@ENABLE_GUDEV_TRUE@ extras/gudev/COPYING \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevmarshal.list \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevenumtypes.h.template \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevenumtypes.c.template \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gjs-example.js \ +@ENABLE_GUDEV_TRUE@ extras/gudev/seed-example-enum.js \ +@ENABLE_GUDEV_TRUE@ extras/gudev/seed-example.js + +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@am__append_9 = $(gir_DATA) $(typelibs_DATA) +@ENABLE_GUDEV_TRUE@am__append_10 = libgudev-install-move-hook +@ENABLE_GUDEV_TRUE@am__append_11 = libgudev-uninstall-move-hook +@ENABLE_HWDB_TRUE@am__append_12 = extras/usb-db/usb-db \ +@ENABLE_HWDB_TRUE@ extras/usb-db/pci-db +@ENABLE_HWDB_TRUE@am__append_13 = \ +@ENABLE_HWDB_TRUE@ rules/rules.d/75-net-description.rules \ +@ENABLE_HWDB_TRUE@ rules/rules.d/75-tty-description.rules \ +@ENABLE_HWDB_TRUE@ rules/rules.d/78-sound-card.rules + +@ENABLE_KEYMAP_TRUE@am__append_14 = $(nodist_extras_keymap_keymap_SOURCES) +@ENABLE_KEYMAP_TRUE@am__append_15 = extras/keymap/check-keymaps.sh +@ENABLE_KEYMAP_TRUE@am__append_16 = extras/keymap/95-keymap.rules \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/95-keyboard-force-release.rules +@ENABLE_KEYMAP_TRUE@am__append_17 = extras/keymap/keymap +@ENABLE_KEYMAP_TRUE@am__append_18 = extras/keymap/findkeyboards \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keyboard-force-release.sh +@ENABLE_KEYMAP_TRUE@am__append_19 = \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keys.txt \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keys-from-name.gperf + +@ENABLE_KEYMAP_TRUE@am__append_20 = keymaps-distcheck-hook +@ENABLE_MTD_PROBE_TRUE@am__append_21 = extras/mtd_probe/75-probe_mtd.rules +@ENABLE_MTD_PROBE_TRUE@am__append_22 = extras/mtd_probe/mtd_probe # ------------------------------------------------------------------------------ -# conditional extras (need glib, libusb, libacl, ...) +# rule_generator - persistent network and optical device rule generator # ------------------------------------------------------------------------------ -@ENABLE_EXTRAS_TRUE@am__append_3 = \ -@ENABLE_EXTRAS_TRUE@ rules/rules.d/75-net-description.rules \ -@ENABLE_EXTRAS_TRUE@ rules/rules.d/75-tty-description.rules \ -@ENABLE_EXTRAS_TRUE@ rules/rules.d/78-sound-card.rules \ -@ENABLE_EXTRAS_TRUE@ extras/hid2hci/70-hid2hci.rules \ -@ENABLE_EXTRAS_TRUE@ extras/udev-acl/70-acl.rules \ -@ENABLE_EXTRAS_TRUE@ extras/mobile-action-modeswitch/61-mobile-action.rules \ -@ENABLE_EXTRAS_TRUE@ extras/mtd_probe/75-probe_mtd.rules \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/95-keymap.rules \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/95-keyboard-force-release.rules -@ENABLE_EXTRAS_TRUE@am__append_4 = extras/gudev/docs -@ENABLE_EXTRAS_TRUE@am__append_5 = extras/gudev/libgudev-1.0.la -@ENABLE_EXTRAS_TRUE@am__append_6 = extras/gudev/gudev-1.0.pc -@ENABLE_EXTRAS_TRUE@am__append_7 = extras/gudev/COPYING \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevmarshal.list \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevenumtypes.h.template \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevenumtypes.c.template \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/check-keymaps.sh -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@am__append_8 = $(gir_DATA) $(typelibs_DATA) -@ENABLE_EXTRAS_TRUE@am__append_9 = libgudev-install-move-hook \ -@ENABLE_EXTRAS_TRUE@ udevacl-install-hook -@ENABLE_EXTRAS_TRUE@am__append_10 = libgudev-uninstall-move-hook -@ENABLE_EXTRAS_TRUE@am__append_11 = extras/hid2hci/hid2hci \ -@ENABLE_EXTRAS_TRUE@ extras/udev-acl/udev-acl \ -@ENABLE_EXTRAS_TRUE@ extras/usb-db/usb-db extras/usb-db/pci-db \ -@ENABLE_EXTRAS_TRUE@ extras/mobile-action-modeswitch/mobile-action-modeswitch \ -@ENABLE_EXTRAS_TRUE@ extras/mtd_probe/mtd_probe \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymap -@ENABLE_EXTRAS_TRUE@am__append_12 = extras/keymap/findkeyboards \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keyboard-force-release.sh -@ENABLE_EXTRAS_TRUE@am__append_13 = \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keys.txt \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keys-from-name.gperf - -@ENABLE_EXTRAS_TRUE@am__append_14 = keymaps-distcheck-hook +@ENABLE_RULE_GENERATOR_TRUE@am__append_23 = \ +@ENABLE_RULE_GENERATOR_TRUE@ extras/rule_generator/write_cd_rules \ +@ENABLE_RULE_GENERATOR_TRUE@ extras/rule_generator/write_net_rules + +@ENABLE_RULE_GENERATOR_TRUE@am__append_24 = \ +@ENABLE_RULE_GENERATOR_TRUE@ extras/rule_generator/75-cd-aliases-generator.rules \ +@ENABLE_RULE_GENERATOR_TRUE@ extras/rule_generator/75-persistent-net-generator.rules + +@ENABLE_UDEV_ACL_TRUE@am__append_25 = extras/udev-acl/70-udev-acl.rules +@ENABLE_UDEV_ACL_TRUE@am__append_26 = extras/udev-acl/udev-acl +@ENABLE_UDEV_ACL_TRUE@am__append_27 = udevacl-install-hook +@ENABLE_FLOPPY_TRUE@am__append_28 = extras/floppy/create_floppy_devices +@ENABLE_FLOPPY_TRUE@am__append_29 = extras/floppy/60-floppy.rules +@ENABLE_EDD_TRUE@am__append_30 = extras/edd_id/edd_id +@ENABLE_EDD_TRUE@am__append_31 = extras/edd_id/61-persistent-storage-edd.rules subdir = . DIST_COMMON = README $(am__configure_deps) $(am__dist_doc_DATA_DIST) \ $(am__dist_libexec_SCRIPTS_DIST) \ + $(am__dist_udevhome_DATA_DIST) \ $(am__dist_udevkeymap_DATA_DIST) \ $(am__dist_udevkeymapforcerel_DATA_DIST) \ $(am__dist_udevrules_DATA_DIST) \ $(am__libgudev_include_HEADERS_DIST) $(dist_man_MANS) \ - $(dist_noinst_DATA) $(dist_udevconf_DATA) \ - $(dist_udevhome_DATA) $(include_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(top_srcdir)/configure \ + $(dist_noinst_DATA) $(dist_udevconf_DATA) $(include_HEADERS) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/config.h.in $(top_srcdir)/configure \ $(top_srcdir)/extras/gudev/gudev-1.0.pc.in \ - $(top_srcdir)/init/udev-retry.service.in \ $(top_srcdir)/init/udev-settle.service.in \ + $(top_srcdir)/init/udev-trigger.service.in \ $(top_srcdir)/init/udev.service.in \ $(top_srcdir)/libudev/libudev.pc.in \ $(top_srcdir)/udev/udev.pc.in COPYING ChangeLog INSTALL NEWS \ - TODO config.guess config.sub depcomp install-sh ltmain.sh \ - missing + TODO build-aux/config.guess build-aux/config.sub \ + build-aux/depcomp build-aux/install-sh build-aux/ltmain.sh \ + build-aux/missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gtk-doc.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ @@ -127,7 +148,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = udev/udev.pc init/udev.service \ - init/udev-settle.service init/udev-retry.service \ + init/udev-trigger.service init/udev-settle.service \ libudev/libudev.pc extras/gudev/gudev-1.0.pc CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -163,8 +184,8 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libexecdir)" \ "$(DESTDIR)$(includedir)" "$(DESTDIR)$(libgudev_includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = -@ENABLE_EXTRAS_TRUE@extras_gudev_libgudev_1_0_la_DEPENDENCIES = \ -@ENABLE_EXTRAS_TRUE@ libudev/libudev.la $(am__DEPENDENCIES_1) +@ENABLE_GUDEV_TRUE@extras_gudev_libgudev_1_0_la_DEPENDENCIES = \ +@ENABLE_GUDEV_TRUE@ libudev/libudev.la $(am__DEPENDENCIES_1) am__extras_gudev_libgudev_1_0_la_SOURCES_DIST = \ extras/gudev/gudevenums.h extras/gudev/gudevenumtypes.h \ extras/gudev/gudevtypes.h extras/gudev/gudevclient.h \ @@ -172,14 +193,14 @@ am__extras_gudev_libgudev_1_0_la_SOURCES_DIST = \ extras/gudev/gudevdevice.c extras/gudev/gudevenumerator.h \ extras/gudev/gudevenumerator.c extras/gudev/gudevprivate.h am__dirstamp = $(am__leading_dot)dirstamp -@ENABLE_EXTRAS_TRUE@am_extras_gudev_libgudev_1_0_la_OBJECTS = extras/gudev/extras_gudev_libgudev_1_0_la-gudevclient.lo \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/extras_gudev_libgudev_1_0_la-gudevdevice.lo \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/extras_gudev_libgudev_1_0_la-gudevenumerator.lo +@ENABLE_GUDEV_TRUE@am_extras_gudev_libgudev_1_0_la_OBJECTS = extras/gudev/extras_gudev_libgudev_1_0_la-gudevclient.lo \ +@ENABLE_GUDEV_TRUE@ extras/gudev/extras_gudev_libgudev_1_0_la-gudevdevice.lo \ +@ENABLE_GUDEV_TRUE@ extras/gudev/extras_gudev_libgudev_1_0_la-gudevenumerator.lo am__dist_extras_gudev_libgudev_1_0_la_SOURCES_DIST = \ extras/gudev/gudevmarshal.h extras/gudev/gudevmarshal.c \ extras/gudev/gudevenumtypes.h extras/gudev/gudevenumtypes.c -@ENABLE_EXTRAS_TRUE@dist_extras_gudev_libgudev_1_0_la_OBJECTS = extras/gudev/extras_gudev_libgudev_1_0_la-gudevmarshal.lo \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/extras_gudev_libgudev_1_0_la-gudevenumtypes.lo +@ENABLE_GUDEV_TRUE@dist_extras_gudev_libgudev_1_0_la_OBJECTS = extras/gudev/extras_gudev_libgudev_1_0_la-gudevmarshal.lo \ +@ENABLE_GUDEV_TRUE@ extras/gudev/extras_gudev_libgudev_1_0_la-gudevenumtypes.lo extras_gudev_libgudev_1_0_la_OBJECTS = \ $(am_extras_gudev_libgudev_1_0_la_OBJECTS) \ $(dist_extras_gudev_libgudev_1_0_la_OBJECTS) @@ -190,8 +211,8 @@ extras_gudev_libgudev_1_0_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(extras_gudev_libgudev_1_0_la_CFLAGS) $(CFLAGS) \ $(extras_gudev_libgudev_1_0_la_LDFLAGS) $(LDFLAGS) -o $@ -@ENABLE_EXTRAS_TRUE@am_extras_gudev_libgudev_1_0_la_rpath = -rpath \ -@ENABLE_EXTRAS_TRUE@ $(libdir) +@ENABLE_GUDEV_TRUE@am_extras_gudev_libgudev_1_0_la_rpath = -rpath \ +@ENABLE_GUDEV_TRUE@ $(libdir) @WITH_SELINUX_TRUE@libudev_libudev_private_la_DEPENDENCIES = \ @WITH_SELINUX_TRUE@ $(am__DEPENDENCIES_1) am__libudev_libudev_private_la_SOURCES_DIST = \ @@ -199,7 +220,7 @@ am__libudev_libudev_private_la_SOURCES_DIST = \ libudev/libudev-list.c libudev/libudev-util.c \ libudev/libudev-device.c libudev/libudev-enumerate.c \ libudev/libudev-monitor.c libudev/libudev-queue.c \ - libudev/libudev-ctrl.c libudev/libudev-util-private.c \ + libudev/libudev-util-private.c \ libudev/libudev-device-private.c \ libudev/libudev-queue-private.c \ libudev/libudev-selinux-private.c @@ -209,7 +230,7 @@ am__objects_1 = libudev/libudev.lo libudev/libudev-list.lo \ libudev/libudev-queue.lo @WITH_SELINUX_TRUE@am__objects_2 = libudev/libudev-selinux-private.lo am_libudev_libudev_private_la_OBJECTS = $(am__objects_1) \ - libudev/libudev-ctrl.lo libudev/libudev-util-private.lo \ + libudev/libudev-util-private.lo \ libudev/libudev-device-private.lo \ libudev/libudev-queue-private.lo $(am__objects_2) libudev_libudev_private_la_OBJECTS = \ @@ -224,14 +245,22 @@ libudev_libudev_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(libudev_libudev_la_LDFLAGS) \ $(LDFLAGS) -o $@ -@ENABLE_EXTRAS_TRUE@am__EXEEXT_1 = extras/hid2hci/hid2hci$(EXEEXT) \ -@ENABLE_EXTRAS_TRUE@ extras/udev-acl/udev-acl$(EXEEXT) \ -@ENABLE_EXTRAS_TRUE@ extras/usb-db/usb-db$(EXEEXT) \ -@ENABLE_EXTRAS_TRUE@ extras/usb-db/pci-db$(EXEEXT) \ -@ENABLE_EXTRAS_TRUE@ extras/mobile-action-modeswitch/mobile-action-modeswitch$(EXEEXT) \ -@ENABLE_EXTRAS_TRUE@ extras/mtd_probe/mtd_probe$(EXEEXT) \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymap$(EXEEXT) +@ENABLE_HWDB_TRUE@am__EXEEXT_1 = extras/usb-db/usb-db$(EXEEXT) \ +@ENABLE_HWDB_TRUE@ extras/usb-db/pci-db$(EXEEXT) +@ENABLE_KEYMAP_TRUE@am__EXEEXT_2 = extras/keymap/keymap$(EXEEXT) +@ENABLE_MTD_PROBE_TRUE@am__EXEEXT_3 = \ +@ENABLE_MTD_PROBE_TRUE@ extras/mtd_probe/mtd_probe$(EXEEXT) +@ENABLE_UDEV_ACL_TRUE@am__EXEEXT_4 = \ +@ENABLE_UDEV_ACL_TRUE@ extras/udev-acl/udev-acl$(EXEEXT) +@ENABLE_FLOPPY_TRUE@am__EXEEXT_5 = extras/floppy/create_floppy_devices$(EXEEXT) +@ENABLE_EDD_TRUE@am__EXEEXT_6 = extras/edd_id/edd_id$(EXEEXT) PROGRAMS = $(libexec_PROGRAMS) $(sbin_PROGRAMS) +am_extras_accelerometer_accelerometer_OBJECTS = \ + extras/accelerometer/accelerometer.$(OBJEXT) +extras_accelerometer_accelerometer_OBJECTS = \ + $(am_extras_accelerometer_accelerometer_OBJECTS) +extras_accelerometer_accelerometer_DEPENDENCIES = \ + libudev/libudev-private.la am_extras_ata_id_ata_id_OBJECTS = extras/ata_id/ata_id.$(OBJEXT) extras_ata_id_ata_id_OBJECTS = $(am_extras_ata_id_ata_id_OBJECTS) extras_ata_id_ata_id_DEPENDENCIES = libudev/libudev-private.la @@ -243,92 +272,60 @@ extras_cdrom_id_cdrom_id_DEPENDENCIES = libudev/libudev-private.la am_extras_collect_collect_OBJECTS = extras/collect/collect.$(OBJEXT) extras_collect_collect_OBJECTS = $(am_extras_collect_collect_OBJECTS) extras_collect_collect_DEPENDENCIES = libudev/libudev-private.la -am_extras_edd_id_edd_id_OBJECTS = extras/edd_id/edd_id.$(OBJEXT) +am__extras_edd_id_edd_id_SOURCES_DIST = extras/edd_id/edd_id.c +@ENABLE_EDD_TRUE@am_extras_edd_id_edd_id_OBJECTS = \ +@ENABLE_EDD_TRUE@ extras/edd_id/edd_id.$(OBJEXT) extras_edd_id_edd_id_OBJECTS = $(am_extras_edd_id_edd_id_OBJECTS) -extras_edd_id_edd_id_DEPENDENCIES = libudev/libudev-private.la +@ENABLE_EDD_TRUE@extras_edd_id_edd_id_DEPENDENCIES = \ +@ENABLE_EDD_TRUE@ libudev/libudev-private.la am_extras_firmware_firmware_OBJECTS = \ extras/firmware/extras_firmware_firmware-firmware.$(OBJEXT) extras_firmware_firmware_OBJECTS = \ $(am_extras_firmware_firmware_OBJECTS) extras_firmware_firmware_DEPENDENCIES = libudev/libudev-private.la -am_extras_floppy_create_floppy_devices_OBJECTS = \ - extras/floppy/create_floppy_devices.$(OBJEXT) +am__extras_floppy_create_floppy_devices_SOURCES_DIST = \ + extras/floppy/create_floppy_devices.c +@ENABLE_FLOPPY_TRUE@am_extras_floppy_create_floppy_devices_OBJECTS = extras/floppy/create_floppy_devices.$(OBJEXT) extras_floppy_create_floppy_devices_OBJECTS = \ $(am_extras_floppy_create_floppy_devices_OBJECTS) -extras_floppy_create_floppy_devices_DEPENDENCIES = \ - libudev/libudev-private.la -am_extras_fstab_import_fstab_import_OBJECTS = \ - extras/fstab_import/fstab_import.$(OBJEXT) -extras_fstab_import_fstab_import_OBJECTS = \ - $(am_extras_fstab_import_fstab_import_OBJECTS) -extras_fstab_import_fstab_import_DEPENDENCIES = \ - libudev/libudev-private.la -am__extras_hid2hci_hid2hci_SOURCES_DIST = extras/hid2hci/hid2hci.c -@ENABLE_EXTRAS_TRUE@am_extras_hid2hci_hid2hci_OBJECTS = extras/hid2hci/extras_hid2hci_hid2hci-hid2hci.$(OBJEXT) -extras_hid2hci_hid2hci_OBJECTS = $(am_extras_hid2hci_hid2hci_OBJECTS) -@ENABLE_EXTRAS_TRUE@extras_hid2hci_hid2hci_DEPENDENCIES = \ -@ENABLE_EXTRAS_TRUE@ libudev/libudev-private.la \ -@ENABLE_EXTRAS_TRUE@ $(am__DEPENDENCIES_1) -am_extras_input_id_input_id_OBJECTS = \ - extras/input_id/input_id.$(OBJEXT) -extras_input_id_input_id_OBJECTS = \ - $(am_extras_input_id_input_id_OBJECTS) -extras_input_id_input_id_DEPENDENCIES = libudev/libudev-private.la +@ENABLE_FLOPPY_TRUE@extras_floppy_create_floppy_devices_DEPENDENCIES = \ +@ENABLE_FLOPPY_TRUE@ libudev/libudev-private.la am__extras_keymap_keymap_SOURCES_DIST = extras/keymap/keymap.c -@ENABLE_EXTRAS_TRUE@am_extras_keymap_keymap_OBJECTS = extras/keymap/extras_keymap_keymap-keymap.$(OBJEXT) +@ENABLE_KEYMAP_TRUE@am_extras_keymap_keymap_OBJECTS = extras/keymap/extras_keymap_keymap-keymap.$(OBJEXT) nodist_extras_keymap_keymap_OBJECTS = extras_keymap_keymap_OBJECTS = $(am_extras_keymap_keymap_OBJECTS) \ $(nodist_extras_keymap_keymap_OBJECTS) extras_keymap_keymap_LDADD = $(LDADD) -am__extras_mobile_action_modeswitch_mobile_action_modeswitch_SOURCES_DIST = \ - extras/mobile-action-modeswitch/mobile-action-modeswitch.c \ - extras/mobile-action-modeswitch/utils.c \ - extras/mobile-action-modeswitch/utils.h \ - extras/mobile-action-modeswitch/ma8280p_us.c \ - extras/mobile-action-modeswitch/ma8280p_us.h -@ENABLE_EXTRAS_TRUE@am_extras_mobile_action_modeswitch_mobile_action_modeswitch_OBJECTS = extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.$(OBJEXT) \ -@ENABLE_EXTRAS_TRUE@ extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.$(OBJEXT) \ -@ENABLE_EXTRAS_TRUE@ extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.$(OBJEXT) -extras_mobile_action_modeswitch_mobile_action_modeswitch_OBJECTS = $(am_extras_mobile_action_modeswitch_mobile_action_modeswitch_OBJECTS) -@ENABLE_EXTRAS_TRUE@extras_mobile_action_modeswitch_mobile_action_modeswitch_DEPENDENCIES = \ -@ENABLE_EXTRAS_TRUE@ libudev/libudev-private.la \ -@ENABLE_EXTRAS_TRUE@ $(am__DEPENDENCIES_1) am__extras_mtd_probe_mtd_probe_SOURCES_DIST = \ extras/mtd_probe/mtd_probe.c extras/mtd_probe/mtd_probe.h \ extras/mtd_probe/probe_smartmedia.c -@ENABLE_EXTRAS_TRUE@am_extras_mtd_probe_mtd_probe_OBJECTS = extras/mtd_probe/extras_mtd_probe_mtd_probe-mtd_probe.$(OBJEXT) \ -@ENABLE_EXTRAS_TRUE@ extras/mtd_probe/extras_mtd_probe_mtd_probe-probe_smartmedia.$(OBJEXT) +@ENABLE_MTD_PROBE_TRUE@am_extras_mtd_probe_mtd_probe_OBJECTS = extras/mtd_probe/extras_mtd_probe_mtd_probe-mtd_probe.$(OBJEXT) \ +@ENABLE_MTD_PROBE_TRUE@ extras/mtd_probe/extras_mtd_probe_mtd_probe-probe_smartmedia.$(OBJEXT) extras_mtd_probe_mtd_probe_OBJECTS = \ $(am_extras_mtd_probe_mtd_probe_OBJECTS) extras_mtd_probe_mtd_probe_LDADD = $(LDADD) -am_extras_path_id_path_id_OBJECTS = extras/path_id/path_id.$(OBJEXT) -extras_path_id_path_id_OBJECTS = $(am_extras_path_id_path_id_OBJECTS) -extras_path_id_path_id_DEPENDENCIES = libudev/libudev-private.la am_extras_scsi_id_scsi_id_OBJECTS = extras/scsi_id/scsi_id.$(OBJEXT) \ extras/scsi_id/scsi_serial.$(OBJEXT) extras_scsi_id_scsi_id_OBJECTS = $(am_extras_scsi_id_scsi_id_OBJECTS) extras_scsi_id_scsi_id_DEPENDENCIES = libudev/libudev-private.la am__extras_udev_acl_udev_acl_SOURCES_DIST = \ extras/udev-acl/udev-acl.c -@ENABLE_EXTRAS_TRUE@am_extras_udev_acl_udev_acl_OBJECTS = extras/udev-acl/extras_udev_acl_udev_acl-udev-acl.$(OBJEXT) +@ENABLE_UDEV_ACL_TRUE@am_extras_udev_acl_udev_acl_OBJECTS = extras/udev-acl/extras_udev_acl_udev_acl-udev-acl.$(OBJEXT) extras_udev_acl_udev_acl_OBJECTS = \ $(am_extras_udev_acl_udev_acl_OBJECTS) -@ENABLE_EXTRAS_TRUE@extras_udev_acl_udev_acl_DEPENDENCIES = \ -@ENABLE_EXTRAS_TRUE@ libudev/libudev-private.la \ -@ENABLE_EXTRAS_TRUE@ $(am__DEPENDENCIES_1) +@ENABLE_UDEV_ACL_TRUE@extras_udev_acl_udev_acl_DEPENDENCIES = \ +@ENABLE_UDEV_ACL_TRUE@ libudev/libudev-private.la \ +@ENABLE_UDEV_ACL_TRUE@ $(am__DEPENDENCIES_1) am__extras_usb_db_pci_db_SOURCES_DIST = extras/usb-db/usb-db.c -@ENABLE_EXTRAS_TRUE@am_extras_usb_db_pci_db_OBJECTS = extras/usb-db/extras_usb_db_pci_db-usb-db.$(OBJEXT) +@ENABLE_HWDB_TRUE@am_extras_usb_db_pci_db_OBJECTS = extras/usb-db/extras_usb_db_pci_db-usb-db.$(OBJEXT) extras_usb_db_pci_db_OBJECTS = $(am_extras_usb_db_pci_db_OBJECTS) -@ENABLE_EXTRAS_TRUE@extras_usb_db_pci_db_DEPENDENCIES = \ -@ENABLE_EXTRAS_TRUE@ libudev/libudev-private.la +@ENABLE_HWDB_TRUE@extras_usb_db_pci_db_DEPENDENCIES = \ +@ENABLE_HWDB_TRUE@ libudev/libudev-private.la am__extras_usb_db_usb_db_SOURCES_DIST = extras/usb-db/usb-db.c -@ENABLE_EXTRAS_TRUE@am_extras_usb_db_usb_db_OBJECTS = extras/usb-db/extras_usb_db_usb_db-usb-db.$(OBJEXT) +@ENABLE_HWDB_TRUE@am_extras_usb_db_usb_db_OBJECTS = extras/usb-db/extras_usb_db_usb_db-usb-db.$(OBJEXT) extras_usb_db_usb_db_OBJECTS = $(am_extras_usb_db_usb_db_OBJECTS) -@ENABLE_EXTRAS_TRUE@extras_usb_db_usb_db_DEPENDENCIES = \ -@ENABLE_EXTRAS_TRUE@ libudev/libudev-private.la -am_extras_usb_id_usb_id_OBJECTS = extras/usb_id/usb_id.$(OBJEXT) -extras_usb_id_usb_id_OBJECTS = $(am_extras_usb_id_usb_id_OBJECTS) -extras_usb_id_usb_id_DEPENDENCIES = libudev/libudev-private.la +@ENABLE_HWDB_TRUE@extras_usb_db_usb_db_DEPENDENCIES = \ +@ENABLE_HWDB_TRUE@ libudev/libudev-private.la am_extras_v4l_id_v4l_id_OBJECTS = extras/v4l_id/v4l_id.$(OBJEXT) extras_v4l_id_v4l_id_OBJECTS = $(am_extras_v4l_id_v4l_id_OBJECTS) extras_v4l_id_v4l_id_DEPENDENCIES = libudev/libudev-private.la @@ -336,27 +333,32 @@ am_libudev_test_libudev_OBJECTS = libudev/test-libudev.$(OBJEXT) libudev_test_libudev_OBJECTS = $(am_libudev_test_libudev_OBJECTS) libudev_test_libudev_DEPENDENCIES = libudev/libudev.la am__objects_3 = udev/udev-event.$(OBJEXT) udev/udev-watch.$(OBJEXT) \ - udev/udev-node.$(OBJEXT) udev/udev-rules.$(OBJEXT) + udev/udev-node.$(OBJEXT) udev/udev-rules.$(OBJEXT) \ + udev/udev-ctrl.$(OBJEXT) udev/udev-builtin.$(OBJEXT) \ + udev/udev-builtin-path_id.$(OBJEXT) \ + udev/udev-builtin-usb_id.$(OBJEXT) \ + udev/udev-builtin-input_id.$(OBJEXT) am_udev_test_udev_OBJECTS = $(am__objects_3) udev/test-udev.$(OBJEXT) udev_test_udev_OBJECTS = $(am_udev_test_udev_OBJECTS) udev_test_udev_DEPENDENCIES = libudev/libudev-private.la am_udev_udevadm_OBJECTS = $(am__objects_3) udev/udevadm.$(OBJEXT) \ udev/udevadm-info.$(OBJEXT) udev/udevadm-control.$(OBJEXT) \ - udev/udevadm-test.$(OBJEXT) udev/udevadm-monitor.$(OBJEXT) \ - udev/udevadm-settle.$(OBJEXT) udev/udevadm-trigger.$(OBJEXT) + udev/udevadm-monitor.$(OBJEXT) udev/udevadm-settle.$(OBJEXT) \ + udev/udevadm-trigger.$(OBJEXT) udev/udevadm-test.$(OBJEXT) \ + udev/udevadm-test-builtin.$(OBJEXT) udev_udevadm_OBJECTS = $(am_udev_udevadm_OBJECTS) udev_udevadm_DEPENDENCIES = libudev/libudev-private.la am_udev_udevd_OBJECTS = $(am__objects_3) udev/udevd.$(OBJEXT) \ udev/sd-daemon.$(OBJEXT) udev_udevd_OBJECTS = $(am_udev_udevd_OBJECTS) udev_udevd_DEPENDENCIES = libudev/libudev-private.la -am__dist_libexec_SCRIPTS_DIST = extras/rule_generator/write_cd_rules \ - extras/rule_generator/write_net_rules \ - extras/keymap/findkeyboards \ - extras/keymap/keyboard-force-release.sh +am__dist_libexec_SCRIPTS_DIST = extras/keymap/findkeyboards \ + extras/keymap/keyboard-force-release.sh \ + extras/rule_generator/write_cd_rules \ + extras/rule_generator/write_net_rules SCRIPTS = $(dist_libexec_SCRIPTS) DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp +depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -384,49 +386,41 @@ am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(extras_gudev_libgudev_1_0_la_SOURCES) \ $(dist_extras_gudev_libgudev_1_0_la_SOURCES) \ $(libudev_libudev_private_la_SOURCES) \ - $(libudev_libudev_la_SOURCES) $(extras_ata_id_ata_id_SOURCES) \ + $(libudev_libudev_la_SOURCES) \ + $(extras_accelerometer_accelerometer_SOURCES) \ + $(extras_ata_id_ata_id_SOURCES) \ $(extras_cdrom_id_cdrom_id_SOURCES) \ $(extras_collect_collect_SOURCES) \ $(extras_edd_id_edd_id_SOURCES) \ $(extras_firmware_firmware_SOURCES) \ $(extras_floppy_create_floppy_devices_SOURCES) \ - $(extras_fstab_import_fstab_import_SOURCES) \ - $(extras_hid2hci_hid2hci_SOURCES) \ - $(extras_input_id_input_id_SOURCES) \ $(extras_keymap_keymap_SOURCES) \ $(nodist_extras_keymap_keymap_SOURCES) \ - $(extras_mobile_action_modeswitch_mobile_action_modeswitch_SOURCES) \ $(extras_mtd_probe_mtd_probe_SOURCES) \ - $(extras_path_id_path_id_SOURCES) \ $(extras_scsi_id_scsi_id_SOURCES) \ $(extras_udev_acl_udev_acl_SOURCES) \ $(extras_usb_db_pci_db_SOURCES) \ $(extras_usb_db_usb_db_SOURCES) \ - $(extras_usb_id_usb_id_SOURCES) \ $(extras_v4l_id_v4l_id_SOURCES) \ $(libudev_test_libudev_SOURCES) $(udev_test_udev_SOURCES) \ $(udev_udevadm_SOURCES) $(udev_udevd_SOURCES) DIST_SOURCES = $(am__extras_gudev_libgudev_1_0_la_SOURCES_DIST) \ $(am__dist_extras_gudev_libgudev_1_0_la_SOURCES_DIST) \ $(am__libudev_libudev_private_la_SOURCES_DIST) \ - $(libudev_libudev_la_SOURCES) $(extras_ata_id_ata_id_SOURCES) \ + $(libudev_libudev_la_SOURCES) \ + $(extras_accelerometer_accelerometer_SOURCES) \ + $(extras_ata_id_ata_id_SOURCES) \ $(extras_cdrom_id_cdrom_id_SOURCES) \ $(extras_collect_collect_SOURCES) \ - $(extras_edd_id_edd_id_SOURCES) \ + $(am__extras_edd_id_edd_id_SOURCES_DIST) \ $(extras_firmware_firmware_SOURCES) \ - $(extras_floppy_create_floppy_devices_SOURCES) \ - $(extras_fstab_import_fstab_import_SOURCES) \ - $(am__extras_hid2hci_hid2hci_SOURCES_DIST) \ - $(extras_input_id_input_id_SOURCES) \ + $(am__extras_floppy_create_floppy_devices_SOURCES_DIST) \ $(am__extras_keymap_keymap_SOURCES_DIST) \ - $(am__extras_mobile_action_modeswitch_mobile_action_modeswitch_SOURCES_DIST) \ $(am__extras_mtd_probe_mtd_probe_SOURCES_DIST) \ - $(extras_path_id_path_id_SOURCES) \ $(extras_scsi_id_scsi_id_SOURCES) \ $(am__extras_udev_acl_udev_acl_SOURCES_DIST) \ $(am__extras_usb_db_pci_db_SOURCES_DIST) \ $(am__extras_usb_db_usb_db_SOURCES_DIST) \ - $(extras_usb_id_usb_id_SOURCES) \ $(extras_v4l_id_v4l_id_SOURCES) \ $(libudev_test_libudev_SOURCES) $(udev_test_udev_SOURCES) \ $(udev_udevadm_SOURCES) $(udev_udevd_SOURCES) @@ -442,6 +436,8 @@ man8dir = $(mandir)/man8 NROFF = nroff MANS = $(dist_man_MANS) am__dist_doc_DATA_DIST = extras/keymap/README.keymap.txt +am__dist_udevhome_DATA_DIST = \ + extras/rule_generator/rule_generator.functions am__dist_udevkeymap_DATA_DIST = extras/keymap/keymaps/acer \ extras/keymap/keymaps/acer-aspire_5720 \ extras/keymap/keymaps/acer-aspire_8930 \ @@ -449,13 +445,16 @@ am__dist_udevkeymap_DATA_DIST = extras/keymap/keymaps/acer \ extras/keymap/keymaps/acer-aspire_6920 \ extras/keymap/keymaps/acer-travelmate_c300 \ extras/keymap/keymaps/asus extras/keymap/keymaps/compaq-e_evo \ - extras/keymap/keymaps/dell extras/keymap/keymaps/everex-xt5000 \ + extras/keymap/keymaps/dell \ + extras/keymap/keymaps/dell-latitude-xt2 \ + extras/keymap/keymaps/everex-xt5000 \ extras/keymap/keymaps/fujitsu-amilo_pa_2548 \ extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 \ extras/keymap/keymaps/fujitsu-amilo_pro_v3205 \ extras/keymap/keymaps/fujitsu-amilo_si_1520 \ extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 \ extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 \ + extras/keymap/keymaps/genius-slimstar-320 \ extras/keymap/keymaps/hewlett-packard \ extras/keymap/keymaps/hewlett-packard-2510p_2530p \ extras/keymap/keymaps/hewlett-packard-compaq_elitebook \ @@ -506,23 +505,22 @@ am__dist_udevrules_DATA_DIST = rules/rules.d/50-udev-default.rules \ rules/rules.d/60-persistent-alsa.rules \ rules/rules.d/80-drivers.rules \ rules/rules.d/95-udev-late.rules \ - extras/rule_generator/75-cd-aliases-generator.rules \ - extras/rule_generator/75-persistent-net-generator.rules \ extras/firmware/50-firmware.rules \ extras/cdrom_id/60-cdrom_id.rules \ - extras/edd_id/61-persistent-storage-edd.rules \ - extras/floppy/60-floppy.rules \ - extras/fstab_import/79-fstab_import.rules \ extras/v4l_id/60-persistent-v4l.rules \ + extras/accelerometer/61-accelerometer.rules \ extras/qemu/42-qemu-usb.rules \ rules/rules.d/75-net-description.rules \ rules/rules.d/75-tty-description.rules \ rules/rules.d/78-sound-card.rules \ - extras/hid2hci/70-hid2hci.rules extras/udev-acl/70-acl.rules \ - extras/mobile-action-modeswitch/61-mobile-action.rules \ - extras/mtd_probe/75-probe_mtd.rules \ extras/keymap/95-keymap.rules \ - extras/keymap/95-keyboard-force-release.rules + extras/keymap/95-keyboard-force-release.rules \ + extras/mtd_probe/75-probe_mtd.rules \ + extras/rule_generator/75-cd-aliases-generator.rules \ + extras/rule_generator/75-persistent-net-generator.rules \ + extras/udev-acl/70-udev-acl.rules \ + extras/floppy/60-floppy.rules \ + extras/edd_id/61-persistent-storage-edd.rules DATA = $(dist_doc_DATA) $(dist_noinst_DATA) $(dist_udevconf_DATA) \ $(dist_udevhome_DATA) $(dist_udevkeymap_DATA) \ $(dist_udevkeymapforcerel_DATA) $(dist_udevrules_DATA) \ @@ -595,6 +593,7 @@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -611,6 +610,8 @@ GLIB_LIBS = @GLIB_LIBS@ GPERF = @GPERF@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ G_IR_COMPILER = @G_IR_COMPILER@ @@ -630,12 +631,11 @@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ -LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -670,6 +670,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -702,7 +703,6 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -721,11 +721,11 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = . libudev/docs $(am__append_4) -EXTRA_DIST = autogen.sh libudev/exported_symbols libudev/COPYING \ - rules/arch rules/misc udev/udev.xml udev/udevadm.xml \ - udev/udevd.xml $(am__append_7) $(TESTS) \ - test/rule-syntax-check.py -ACLOCAL_AMFLAGS = -I m4 +EXTRA_DIST = autogen.sh libudev/COPYING rules/arch rules/misc \ + $(am__append_2) udev/udev.xml udev/udevadm.xml udev/udevd.xml \ + extras/scsi_id/README $(am__append_8) $(am__append_15) \ + $(TESTS) test/rule-syntax-check.py +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} AM_MAKEFLAGS = --no-print-directory AM_CPPFLAGS = \ -include $(top_builddir)/config.h \ @@ -733,26 +733,35 @@ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DLIBEXECDIR=\""$(libexecdir)"\" +AM_CFLAGS = \ + -fvisibility=hidden \ + -ffunction-sections \ + -fdata-sections + AM_LDFLAGS = \ + -Wl,--gc-sections \ -Wl,--as-needed DISTCHECK_CONFIGURE_FLAGS = \ --enable-gtk-doc \ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) -CLEANFILES = $(am__append_8) $(am__append_13) udev-$(VERSION).tar.gz \ +CLEANFILES = $(am__append_9) $(am__append_19) udev-$(VERSION).tar.gz \ udev-$(VERSION).tar.bz2 $(BUILT_SOURCES) -INSTALL_EXEC_HOOKS = libudev-install-move-hook $(am__append_9) -INSTALL_DATA_HOOKS = udev-confdirs $(am__append_2) -UNINSTALL_EXEC_HOOKS = libudev-uninstall-move-hook $(am__append_10) -DISTCHECK_HOOKS = $(am__append_14) +BUILT_SOURCES = $(am__append_7) $(am__append_14) +INSTALL_EXEC_HOOKS = libudev-install-move-hook $(am__append_10) \ + $(am__append_27) +INSTALL_DATA_HOOKS = udev-confdirs $(am__append_3) +UNINSTALL_EXEC_HOOKS = libudev-uninstall-move-hook $(am__append_11) +DISTCHECK_HOOKS = $(am__append_20) +dist_libexec_SCRIPTS = $(am__append_18) $(am__append_23) # ------------------------------------------------------------------------------ # libudev # ------------------------------------------------------------------------------ -LIBUDEV_CURRENT = 10 +LIBUDEV_CURRENT = 13 LIBUDEV_REVISION = 0 -LIBUDEV_AGE = 10 +LIBUDEV_AGE = 13 include_HEADERS = libudev/libudev.h lib_LTLIBRARIES = libudev/libudev.la $(am__append_5) libudev_libudev_la_SOURCES = \ @@ -766,14 +775,13 @@ libudev_libudev_la_SOURCES = \ libudev/libudev-queue.c libudev_libudev_la_LDFLAGS = \ - -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE) \ - -export-symbols $(top_srcdir)/libudev/exported_symbols + -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE) noinst_LTLIBRARIES = \ libudev/libudev-private.la libudev_libudev_private_la_SOURCES = $(libudev_libudev_la_SOURCES) \ - libudev/libudev-ctrl.c libudev/libudev-util-private.c \ + libudev/libudev-util-private.c \ libudev/libudev-device-private.c \ libudev/libudev-queue-private.c $(am__append_1) @WITH_SELINUX_TRUE@libudev_libudev_private_la_LIBADD = $(SELINUX_LIBS) @@ -792,30 +800,35 @@ dist_udevrules_DATA = rules/rules.d/50-udev-default.rules \ rules/rules.d/60-persistent-alsa.rules \ rules/rules.d/80-drivers.rules \ rules/rules.d/95-udev-late.rules \ - extras/rule_generator/75-cd-aliases-generator.rules \ - extras/rule_generator/75-persistent-net-generator.rules \ extras/firmware/50-firmware.rules \ extras/cdrom_id/60-cdrom_id.rules \ - extras/edd_id/61-persistent-storage-edd.rules \ - extras/floppy/60-floppy.rules \ - extras/fstab_import/79-fstab_import.rules \ extras/v4l_id/60-persistent-v4l.rules \ - extras/qemu/42-qemu-usb.rules $(am__append_3) + extras/accelerometer/61-accelerometer.rules \ + extras/qemu/42-qemu-usb.rules $(am__append_13) \ + $(am__append_16) $(am__append_21) $(am__append_24) \ + $(am__append_25) $(am__append_29) $(am__append_31) udevconfdir = $(sysconfdir)/udev dist_udevconf_DATA = udev.conf sharepkgconfigdir = $(datadir)/pkgconfig sharepkgconfig_DATA = udev/udev.pc @WITH_SYSTEMD_TRUE@systemdsystemunit_DATA = \ +@WITH_SYSTEMD_TRUE@ init/udev-control.socket \ +@WITH_SYSTEMD_TRUE@ init/udev-kernel.socket \ @WITH_SYSTEMD_TRUE@ init/udev.service \ -@WITH_SYSTEMD_TRUE@ init/udev-settle.service \ -@WITH_SYSTEMD_TRUE@ init/udev-retry.service +@WITH_SYSTEMD_TRUE@ init/udev-trigger.service \ +@WITH_SYSTEMD_TRUE@ init/udev-settle.service udev_common_sources = \ udev/udev.h \ udev/udev-event.c \ udev/udev-watch.c \ udev/udev-node.c \ - udev/udev-rules.c + udev/udev-rules.c \ + udev/udev-ctrl.c \ + udev/udev-builtin.c \ + udev/udev-builtin-path_id.c \ + udev/udev-builtin-usb_id.c \ + udev/udev-builtin-input_id.c udev_udevd_SOURCES = \ $(udev_common_sources) \ @@ -829,10 +842,11 @@ udev_udevadm_SOURCES = \ udev/udevadm.c \ udev/udevadm-info.c \ udev/udevadm-control.c \ - udev/udevadm-test.c \ udev/udevadm-monitor.c \ udev/udevadm-settle.c \ - udev/udevadm-trigger.c + udev/udevadm-trigger.c \ + udev/udevadm-test.c \ + udev/udevadm-test-builtin.c udev_udevadm_LDADD = libudev/libudev-private.la @@ -860,14 +874,6 @@ udev_test_udev_SOURCES = \ udev_test_udev_LDADD = libudev/libudev-private.la # ------------------------------------------------------------------------------ -# rule_generator - persistent network and optical device rule generator -# ------------------------------------------------------------------------------ -dist_libexec_SCRIPTS = extras/rule_generator/write_cd_rules \ - extras/rule_generator/write_net_rules $(am__append_12) -udevhomedir = $(libexecdir) -dist_udevhome_DATA = extras/rule_generator/rule_generator.functions - -# ------------------------------------------------------------------------------ # firmware - firmware loading # ------------------------------------------------------------------------------ extras_firmware_firmware_SOURCES = extras/firmware/firmware.c @@ -893,36 +899,6 @@ extras_collect_collect_SOURCES = extras/collect/collect.c extras_collect_collect_LDADD = libudev/libudev-private.la # ------------------------------------------------------------------------------ -# edd_id - BIOS EDD block device match -# ------------------------------------------------------------------------------ -extras_edd_id_edd_id_SOURCES = extras/edd_id/edd_id.c -extras_edd_id_edd_id_LDADD = libudev/libudev-private.la - -# ------------------------------------------------------------------------------ -# create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) -# ------------------------------------------------------------------------------ -extras_floppy_create_floppy_devices_SOURCES = extras/floppy/create_floppy_devices.c -extras_floppy_create_floppy_devices_LDADD = libudev/libudev-private.la - -# ------------------------------------------------------------------------------ -# input_id - import input device class -# ------------------------------------------------------------------------------ -extras_input_id_input_id_SOURCES = extras/input_id/input_id.c -extras_input_id_input_id_LDADD = libudev/libudev-private.la - -# ------------------------------------------------------------------------------ -# path_id - compose identifier of persistent elements of the parent buses -# ------------------------------------------------------------------------------ -extras_path_id_path_id_SOURCES = extras/path_id/path_id.c -extras_path_id_path_id_LDADD = libudev/libudev-private.la - -# ------------------------------------------------------------------------------ -# fstab_import - import /etc/fstab entry for block device -# ------------------------------------------------------------------------------ -extras_fstab_import_fstab_import_SOURCES = extras/fstab_import/fstab_import.c -extras_fstab_import_fstab_import_LDADD = libudev/libudev-private.la - -# ------------------------------------------------------------------------------ # scsi_id - SCSI inquiry to get various serial numbers # ------------------------------------------------------------------------------ extras_scsi_id_scsi_id_SOURCES = \ @@ -934,201 +910,194 @@ extras_scsi_id_scsi_id_SOURCES = \ extras_scsi_id_scsi_id_LDADD = libudev/libudev-private.la # ------------------------------------------------------------------------------ -# usb_id - USB device property import -# ------------------------------------------------------------------------------ -extras_usb_id_usb_id_SOURCES = extras/usb_id/usb_id.c -extras_usb_id_usb_id_LDADD = libudev/libudev-private.la - -# ------------------------------------------------------------------------------ # v4l_id - video4linux capabilities # ------------------------------------------------------------------------------ extras_v4l_id_v4l_id_SOURCES = extras/v4l_id/v4l_id.c extras_v4l_id_v4l_id_LDADD = libudev/libudev-private.la # ------------------------------------------------------------------------------ -# GUdev - libudev gobject interface +# accelerometer - updates device orientation # ------------------------------------------------------------------------------ -@ENABLE_EXTRAS_TRUE@LIBGUDEV_CURRENT = 1 -@ENABLE_EXTRAS_TRUE@LIBGUDEV_REVISION = 0 -@ENABLE_EXTRAS_TRUE@LIBGUDEV_AGE = 1 -@ENABLE_EXTRAS_TRUE@libgudev_includedir = $(includedir)/gudev-1.0/gudev -@ENABLE_EXTRAS_TRUE@libgudev_include_HEADERS = \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudev.h \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevenums.h \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevenumtypes.h \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevtypes.h \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevclient.h \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevdevice.h \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevenumerator.h - -@ENABLE_EXTRAS_TRUE@extras_gudev_libgudev_1_0_la_SOURCES = \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevenums.h \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevenumtypes.h \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevenumtypes.h\ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevtypes.h \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevclient.h \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevclient.c \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevdevice.h \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevdevice.c \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevenumerator.h \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevenumerator.c \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevprivate.h - -@ENABLE_EXTRAS_TRUE@dist_extras_gudev_libgudev_1_0_la_SOURCES = \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevmarshal.h \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevmarshal.c \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevenumtypes.h \ -@ENABLE_EXTRAS_TRUE@ extras/gudev/gudevenumtypes.c - -@ENABLE_EXTRAS_TRUE@BUILT_SOURCES = $(dist_extras_gudev_libgudev_1_0_la_SOURCES) \ -@ENABLE_EXTRAS_TRUE@ $(nodist_extras_keymap_keymap_SOURCES) -@ENABLE_EXTRAS_TRUE@extras_gudev_libgudev_1_0_la_CPPFLAGS = \ -@ENABLE_EXTRAS_TRUE@ $(AM_CPPFLAGS) \ -@ENABLE_EXTRAS_TRUE@ -I$(top_builddir)/extras \ -@ENABLE_EXTRAS_TRUE@ -I$(top_srcdir)/extras \ -@ENABLE_EXTRAS_TRUE@ -I$(top_builddir)/extras/gudev \ -@ENABLE_EXTRAS_TRUE@ -I$(top_srcdir)/extras/gudev \ -@ENABLE_EXTRAS_TRUE@ -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \ -@ENABLE_EXTRAS_TRUE@ -D_GUDEV_COMPILATION \ -@ENABLE_EXTRAS_TRUE@ -DG_LOG_DOMAIN=\"GUdev\" - -@ENABLE_EXTRAS_TRUE@extras_gudev_libgudev_1_0_la_CFLAGS = $(GLIB_CFLAGS) -@ENABLE_EXTRAS_TRUE@extras_gudev_libgudev_1_0_la_LIBADD = libudev/libudev.la $(GLIB_LIBS) -@ENABLE_EXTRAS_TRUE@extras_gudev_libgudev_1_0_la_LDFLAGS = \ -@ENABLE_EXTRAS_TRUE@ -version-info $(LIBGUDEV_CURRENT):$(LIBGUDEV_REVISION):$(LIBGUDEV_AGE) \ -@ENABLE_EXTRAS_TRUE@ -export-dynamic -no-undefined \ -@ENABLE_EXTRAS_TRUE@ -export-symbols-regex '^g_udev_.*' - -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@girdir = $(GIRDIR) -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@gir_DATA = extras/gudev/GUdev-1.0.gir -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@typelibsdir = $(GIRTYPELIBDIR) -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@typelibs_DATA = extras/gudev/GUdev-1.0.typelib +extras_accelerometer_accelerometer_SOURCES = extras/accelerometer/accelerometer.c +extras_accelerometer_accelerometer_LDADD = libudev/libudev-private.la -lm # ------------------------------------------------------------------------------ -# Bluetooth HID devices with special magic to switch the device +# GUdev - libudev gobject interface # ------------------------------------------------------------------------------ -@ENABLE_EXTRAS_TRUE@extras_hid2hci_hid2hci_SOURCES = extras/hid2hci/hid2hci.c -@ENABLE_EXTRAS_TRUE@extras_hid2hci_hid2hci_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) -@ENABLE_EXTRAS_TRUE@extras_hid2hci_hid2hci_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) +@ENABLE_GUDEV_TRUE@LIBGUDEV_CURRENT = 1 +@ENABLE_GUDEV_TRUE@LIBGUDEV_REVISION = 0 +@ENABLE_GUDEV_TRUE@LIBGUDEV_AGE = 1 +@ENABLE_GUDEV_TRUE@libgudev_includedir = $(includedir)/gudev-1.0/gudev +@ENABLE_GUDEV_TRUE@libgudev_include_HEADERS = \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudev.h \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevenums.h \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevenumtypes.h \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevtypes.h \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevclient.h \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevdevice.h \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevenumerator.h + +@ENABLE_GUDEV_TRUE@extras_gudev_libgudev_1_0_la_SOURCES = \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevenums.h \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevenumtypes.h \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevenumtypes.h\ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevtypes.h \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevclient.h \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevclient.c \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevdevice.h \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevdevice.c \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevenumerator.h \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevenumerator.c \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevprivate.h + +@ENABLE_GUDEV_TRUE@dist_extras_gudev_libgudev_1_0_la_SOURCES = \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevmarshal.h \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevmarshal.c \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevenumtypes.h \ +@ENABLE_GUDEV_TRUE@ extras/gudev/gudevenumtypes.c + +@ENABLE_GUDEV_TRUE@extras_gudev_libgudev_1_0_la_CPPFLAGS = \ +@ENABLE_GUDEV_TRUE@ $(AM_CPPFLAGS) \ +@ENABLE_GUDEV_TRUE@ -I$(top_builddir)/extras \ +@ENABLE_GUDEV_TRUE@ -I$(top_srcdir)/extras \ +@ENABLE_GUDEV_TRUE@ -I$(top_builddir)/extras/gudev \ +@ENABLE_GUDEV_TRUE@ -I$(top_srcdir)/extras/gudev \ +@ENABLE_GUDEV_TRUE@ -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \ +@ENABLE_GUDEV_TRUE@ -D_GUDEV_COMPILATION \ +@ENABLE_GUDEV_TRUE@ -DG_LOG_DOMAIN=\"GUdev\" + +@ENABLE_GUDEV_TRUE@extras_gudev_libgudev_1_0_la_CFLAGS = \ +@ENABLE_GUDEV_TRUE@ -fvisibility=default \ +@ENABLE_GUDEV_TRUE@ $(GLIB_CFLAGS) + +@ENABLE_GUDEV_TRUE@extras_gudev_libgudev_1_0_la_LIBADD = libudev/libudev.la $(GLIB_LIBS) +@ENABLE_GUDEV_TRUE@extras_gudev_libgudev_1_0_la_LDFLAGS = \ +@ENABLE_GUDEV_TRUE@ -version-info $(LIBGUDEV_CURRENT):$(LIBGUDEV_REVISION):$(LIBGUDEV_AGE) \ +@ENABLE_GUDEV_TRUE@ -export-dynamic -no-undefined \ +@ENABLE_GUDEV_TRUE@ -export-symbols-regex '^g_udev_.*' + +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@girdir = $(GIRDIR) +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@gir_DATA = extras/gudev/GUdev-1.0.gir +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@typelibsdir = $(GIRTYPELIBDIR) +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@typelibs_DATA = extras/gudev/GUdev-1.0.typelib # ------------------------------------------------------------------------------ -# udev_acl - apply ACLs for users with local forground sessions +# usb/pci-db - read vendor/device string database # ------------------------------------------------------------------------------ -@ENABLE_EXTRAS_TRUE@extras_udev_acl_udev_acl_SOURCES = extras/udev-acl/udev-acl.c -@ENABLE_EXTRAS_TRUE@extras_udev_acl_udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) -@ENABLE_EXTRAS_TRUE@extras_udev_acl_udev_acl_LDADD = libudev/libudev-private.la -lacl $(GLIB_LIBS) +@ENABLE_HWDB_TRUE@extras_usb_db_usb_db_SOURCES = extras/usb-db/usb-db.c +@ENABLE_HWDB_TRUE@extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB +@ENABLE_HWDB_TRUE@extras_usb_db_usb_db_LDADD = libudev/libudev-private.la +@ENABLE_HWDB_TRUE@extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c +@ENABLE_HWDB_TRUE@extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI +@ENABLE_HWDB_TRUE@extras_usb_db_pci_db_LDADD = libudev/libudev-private.la # ------------------------------------------------------------------------------ -# usb-db - read USB vendor/device string database +# keymap - map custom hardware's multimedia keys # ------------------------------------------------------------------------------ -@ENABLE_EXTRAS_TRUE@extras_usb_db_usb_db_SOURCES = extras/usb-db/usb-db.c -@ENABLE_EXTRAS_TRUE@extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB -@ENABLE_EXTRAS_TRUE@extras_usb_db_usb_db_LDADD = libudev/libudev-private.la +@ENABLE_KEYMAP_TRUE@extras_keymap_keymap_SOURCES = extras/keymap/keymap.c +@ENABLE_KEYMAP_TRUE@extras_keymap_keymap_CPPFLAGS = $(AM_CPPFLAGS) -I extras/keymap +@ENABLE_KEYMAP_TRUE@nodist_extras_keymap_keymap_SOURCES = \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keys-from-name.h \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keys-to-name.h + +@ENABLE_KEYMAP_TRUE@dist_doc_DATA = extras/keymap/README.keymap.txt +@ENABLE_KEYMAP_TRUE@udevkeymapdir = $(libexecdir)/keymaps +@ENABLE_KEYMAP_TRUE@dist_udevkeymap_DATA = \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/acer \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/acer-aspire_5720 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/acer-aspire_8930 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/acer-aspire_5920g \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/acer-aspire_6920 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/acer-travelmate_c300 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/asus \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/compaq-e_evo \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/dell \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/dell-latitude-xt2 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/everex-xt5000 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/fujitsu-amilo_pa_2548 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/fujitsu-amilo_pro_v3205 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/fujitsu-amilo_si_1520 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/genius-slimstar-320 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/hewlett-packard \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/hewlett-packard-2510p_2530p \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/hewlett-packard-compaq_elitebook \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/hewlett-packard-pavilion \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/hewlett-packard-presario-2100 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/hewlett-packard-tablet \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/hewlett-packard-tx2 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/inventec-symphony_6.0_7.0 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/lenovo-3000 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/lenovo-ideapad \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/lenovo-thinkpad_x6_tablet \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/lenovo-thinkpad_x200_tablet \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/lg-x110 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/logitech-wave \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/logitech-wave-cordless \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/logitech-wave-pro-cordless \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/maxdata-pro_7000 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/medion-fid2060 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/medionnb-a555 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/micro-star \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/module-asus-w3j \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/module-ibm \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/module-lenovo \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/module-sony \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/module-sony-old \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/module-sony-vgn \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/olpc-xo \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/onkyo \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/oqo-model2 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/samsung-other \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/samsung-sq1us \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/samsung-sx20s \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/toshiba-satellite_a100 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/toshiba-satellite_a110 \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/toshiba-satellite_m30x \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/keymaps/zepto-znote + +@ENABLE_KEYMAP_TRUE@udevkeymapforcereldir = $(libexecdir)/keymaps/force-release +@ENABLE_KEYMAP_TRUE@dist_udevkeymapforcerel_DATA = \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/force-release-maps/dell-touchpad \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/force-release-maps/hp-other \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/force-release-maps/samsung-other \ +@ENABLE_KEYMAP_TRUE@ extras/keymap/force-release-maps/common-volume-keys -# ------------------------------------------------------------------------------ -# pci-db - read PCI vendor/device string database -# ------------------------------------------------------------------------------ -@ENABLE_EXTRAS_TRUE@extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c -@ENABLE_EXTRAS_TRUE@extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI -@ENABLE_EXTRAS_TRUE@extras_usb_db_pci_db_LDADD = libudev/libudev-private.la # ------------------------------------------------------------------------------ -# mobile-action-modeswitch - switch Mobile Action cables into serial mode +# mtd_probe - autoloads FTL module for mtd devices # ------------------------------------------------------------------------------ -@ENABLE_EXTRAS_TRUE@extras_mobile_action_modeswitch_mobile_action_modeswitch_SOURCES = \ -@ENABLE_EXTRAS_TRUE@ extras/mobile-action-modeswitch/mobile-action-modeswitch.c \ -@ENABLE_EXTRAS_TRUE@ extras/mobile-action-modeswitch/utils.c \ -@ENABLE_EXTRAS_TRUE@ extras/mobile-action-modeswitch/utils.h \ -@ENABLE_EXTRAS_TRUE@ extras/mobile-action-modeswitch/ma8280p_us.c \ -@ENABLE_EXTRAS_TRUE@ extras/mobile-action-modeswitch/ma8280p_us.h +@ENABLE_MTD_PROBE_TRUE@extras_mtd_probe_mtd_probe_SOURCES = \ +@ENABLE_MTD_PROBE_TRUE@ extras/mtd_probe/mtd_probe.c \ +@ENABLE_MTD_PROBE_TRUE@ extras/mtd_probe/mtd_probe.h \ +@ENABLE_MTD_PROBE_TRUE@ extras/mtd_probe/probe_smartmedia.c -@ENABLE_EXTRAS_TRUE@extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) -@ENABLE_EXTRAS_TRUE@extras_mobile_action_modeswitch_mobile_action_modeswitch_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) +@ENABLE_MTD_PROBE_TRUE@extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) +@ENABLE_RULE_GENERATOR_TRUE@udevhomedir = $(libexecdir) +@ENABLE_RULE_GENERATOR_TRUE@dist_udevhome_DATA = extras/rule_generator/rule_generator.functions # ------------------------------------------------------------------------------ -# mtd_probe - autoloads FTL module for mtd devices +# udev_acl - apply ACLs for users with local forground sessions # ------------------------------------------------------------------------------ -@ENABLE_EXTRAS_TRUE@extras_mtd_probe_mtd_probe_SOURCES = \ -@ENABLE_EXTRAS_TRUE@ extras/mtd_probe/mtd_probe.c \ -@ENABLE_EXTRAS_TRUE@ extras/mtd_probe/mtd_probe.h \ -@ENABLE_EXTRAS_TRUE@ extras/mtd_probe/probe_smartmedia.c - -@ENABLE_EXTRAS_TRUE@extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) +@ENABLE_UDEV_ACL_TRUE@extras_udev_acl_udev_acl_SOURCES = extras/udev-acl/udev-acl.c +@ENABLE_UDEV_ACL_TRUE@extras_udev_acl_udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) +@ENABLE_UDEV_ACL_TRUE@extras_udev_acl_udev_acl_LDADD = libudev/libudev-private.la -lacl $(GLIB_LIBS) # ------------------------------------------------------------------------------ -# keymap - map custom hardware's multimedia keys +# create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) # ------------------------------------------------------------------------------ -@ENABLE_EXTRAS_TRUE@extras_keymap_keymap_SOURCES = extras/keymap/keymap.c -@ENABLE_EXTRAS_TRUE@extras_keymap_keymap_CPPFLAGS = $(AM_CPPFLAGS) -I extras/keymap -@ENABLE_EXTRAS_TRUE@nodist_extras_keymap_keymap_SOURCES = \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keys-from-name.h \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keys-to-name.h - -@ENABLE_EXTRAS_TRUE@dist_doc_DATA = extras/keymap/README.keymap.txt -@ENABLE_EXTRAS_TRUE@udevkeymapdir = $(libexecdir)/keymaps -@ENABLE_EXTRAS_TRUE@dist_udevkeymap_DATA = \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/acer \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/acer-aspire_5720 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/acer-aspire_8930 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/acer-aspire_5920g \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/acer-aspire_6920 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/acer-travelmate_c300 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/asus \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/compaq-e_evo \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/dell \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/everex-xt5000 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/fujitsu-amilo_pa_2548 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/fujitsu-amilo_pro_v3205 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/fujitsu-amilo_si_1520 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/hewlett-packard \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/hewlett-packard-2510p_2530p \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/hewlett-packard-compaq_elitebook \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/hewlett-packard-pavilion \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/hewlett-packard-presario-2100 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/hewlett-packard-tablet \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/hewlett-packard-tx2 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/inventec-symphony_6.0_7.0 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/lenovo-3000 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/lenovo-ideapad \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/lenovo-thinkpad_x6_tablet \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/lenovo-thinkpad_x200_tablet \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/lg-x110 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/logitech-wave \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/logitech-wave-cordless \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/logitech-wave-pro-cordless \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/maxdata-pro_7000 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/medion-fid2060 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/medionnb-a555 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/micro-star \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/module-asus-w3j \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/module-ibm \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/module-lenovo \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/module-sony \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/module-sony-old \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/module-sony-vgn \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/olpc-xo \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/onkyo \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/oqo-model2 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/samsung-other \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/samsung-sq1us \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/samsung-sx20s \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/toshiba-satellite_a100 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/toshiba-satellite_a110 \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/toshiba-satellite_m30x \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/keymaps/zepto-znote - -@ENABLE_EXTRAS_TRUE@udevkeymapforcereldir = $(libexecdir)/keymaps/force-release -@ENABLE_EXTRAS_TRUE@dist_udevkeymapforcerel_DATA = \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/force-release-maps/dell-touchpad \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/force-release-maps/hp-other \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/force-release-maps/samsung-other \ -@ENABLE_EXTRAS_TRUE@ extras/keymap/force-release-maps/common-volume-keys +@ENABLE_FLOPPY_TRUE@extras_floppy_create_floppy_devices_SOURCES = extras/floppy/create_floppy_devices.c +@ENABLE_FLOPPY_TRUE@extras_floppy_create_floppy_devices_LDADD = libudev/libudev-private.la +# ------------------------------------------------------------------------------ +# edd_id - create /dev/disk/by-id/edd-* links for BIOS EDD data +# ------------------------------------------------------------------------------ +@ENABLE_EDD_TRUE@extras_edd_id_edd_id_SOURCES = extras/edd_id/edd_id.c +@ENABLE_EDD_TRUE@extras_edd_id_edd_id_LDADD = libudev/libudev-private.la # ------------------------------------------------------------------------------ # custom release helpers @@ -1194,9 +1163,9 @@ udev/udev.pc: $(top_builddir)/config.status $(top_srcdir)/udev/udev.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ init/udev.service: $(top_builddir)/config.status $(top_srcdir)/init/udev.service.in cd $(top_builddir) && $(SHELL) ./config.status $@ -init/udev-settle.service: $(top_builddir)/config.status $(top_srcdir)/init/udev-settle.service.in +init/udev-trigger.service: $(top_builddir)/config.status $(top_srcdir)/init/udev-trigger.service.in cd $(top_builddir) && $(SHELL) ./config.status $@ -init/udev-retry.service: $(top_builddir)/config.status $(top_srcdir)/init/udev-retry.service.in +init/udev-settle.service: $(top_builddir)/config.status $(top_srcdir)/init/udev-settle.service.in cd $(top_builddir) && $(SHELL) ./config.status $@ libudev/libudev.pc: $(top_builddir)/config.status $(top_srcdir)/libudev/libudev.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ @@ -1285,8 +1254,6 @@ libudev/libudev-monitor.lo: libudev/$(am__dirstamp) \ libudev/$(DEPDIR)/$(am__dirstamp) libudev/libudev-queue.lo: libudev/$(am__dirstamp) \ libudev/$(DEPDIR)/$(am__dirstamp) -libudev/libudev-ctrl.lo: libudev/$(am__dirstamp) \ - libudev/$(DEPDIR)/$(am__dirstamp) libudev/libudev-util-private.lo: libudev/$(am__dirstamp) \ libudev/$(DEPDIR)/$(am__dirstamp) libudev/libudev-device-private.lo: libudev/$(am__dirstamp) \ @@ -1394,6 +1361,18 @@ clean-sbinPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list +extras/accelerometer/$(am__dirstamp): + @$(MKDIR_P) extras/accelerometer + @: > extras/accelerometer/$(am__dirstamp) +extras/accelerometer/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) extras/accelerometer/$(DEPDIR) + @: > extras/accelerometer/$(DEPDIR)/$(am__dirstamp) +extras/accelerometer/accelerometer.$(OBJEXT): \ + extras/accelerometer/$(am__dirstamp) \ + extras/accelerometer/$(DEPDIR)/$(am__dirstamp) +extras/accelerometer/accelerometer$(EXEEXT): $(extras_accelerometer_accelerometer_OBJECTS) $(extras_accelerometer_accelerometer_DEPENDENCIES) extras/accelerometer/$(am__dirstamp) + @rm -f extras/accelerometer/accelerometer$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(extras_accelerometer_accelerometer_OBJECTS) $(extras_accelerometer_accelerometer_LDADD) $(LIBS) extras/ata_id/$(am__dirstamp): @$(MKDIR_P) extras/ata_id @: > extras/ata_id/$(am__dirstamp) @@ -1462,41 +1441,6 @@ extras/floppy/create_floppy_devices.$(OBJEXT): \ extras/floppy/create_floppy_devices$(EXEEXT): $(extras_floppy_create_floppy_devices_OBJECTS) $(extras_floppy_create_floppy_devices_DEPENDENCIES) extras/floppy/$(am__dirstamp) @rm -f extras/floppy/create_floppy_devices$(EXEEXT) $(AM_V_CCLD)$(LINK) $(extras_floppy_create_floppy_devices_OBJECTS) $(extras_floppy_create_floppy_devices_LDADD) $(LIBS) -extras/fstab_import/$(am__dirstamp): - @$(MKDIR_P) extras/fstab_import - @: > extras/fstab_import/$(am__dirstamp) -extras/fstab_import/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) extras/fstab_import/$(DEPDIR) - @: > extras/fstab_import/$(DEPDIR)/$(am__dirstamp) -extras/fstab_import/fstab_import.$(OBJEXT): \ - extras/fstab_import/$(am__dirstamp) \ - extras/fstab_import/$(DEPDIR)/$(am__dirstamp) -extras/fstab_import/fstab_import$(EXEEXT): $(extras_fstab_import_fstab_import_OBJECTS) $(extras_fstab_import_fstab_import_DEPENDENCIES) extras/fstab_import/$(am__dirstamp) - @rm -f extras/fstab_import/fstab_import$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(extras_fstab_import_fstab_import_OBJECTS) $(extras_fstab_import_fstab_import_LDADD) $(LIBS) -extras/hid2hci/$(am__dirstamp): - @$(MKDIR_P) extras/hid2hci - @: > extras/hid2hci/$(am__dirstamp) -extras/hid2hci/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) extras/hid2hci/$(DEPDIR) - @: > extras/hid2hci/$(DEPDIR)/$(am__dirstamp) -extras/hid2hci/extras_hid2hci_hid2hci-hid2hci.$(OBJEXT): \ - extras/hid2hci/$(am__dirstamp) \ - extras/hid2hci/$(DEPDIR)/$(am__dirstamp) -extras/hid2hci/hid2hci$(EXEEXT): $(extras_hid2hci_hid2hci_OBJECTS) $(extras_hid2hci_hid2hci_DEPENDENCIES) extras/hid2hci/$(am__dirstamp) - @rm -f extras/hid2hci/hid2hci$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(extras_hid2hci_hid2hci_OBJECTS) $(extras_hid2hci_hid2hci_LDADD) $(LIBS) -extras/input_id/$(am__dirstamp): - @$(MKDIR_P) extras/input_id - @: > extras/input_id/$(am__dirstamp) -extras/input_id/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) extras/input_id/$(DEPDIR) - @: > extras/input_id/$(DEPDIR)/$(am__dirstamp) -extras/input_id/input_id.$(OBJEXT): extras/input_id/$(am__dirstamp) \ - extras/input_id/$(DEPDIR)/$(am__dirstamp) -extras/input_id/input_id$(EXEEXT): $(extras_input_id_input_id_OBJECTS) $(extras_input_id_input_id_DEPENDENCIES) extras/input_id/$(am__dirstamp) - @rm -f extras/input_id/input_id$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(extras_input_id_input_id_OBJECTS) $(extras_input_id_input_id_LDADD) $(LIBS) extras/keymap/$(am__dirstamp): @$(MKDIR_P) extras/keymap @: > extras/keymap/$(am__dirstamp) @@ -1509,24 +1453,6 @@ extras/keymap/extras_keymap_keymap-keymap.$(OBJEXT): \ extras/keymap/keymap$(EXEEXT): $(extras_keymap_keymap_OBJECTS) $(extras_keymap_keymap_DEPENDENCIES) extras/keymap/$(am__dirstamp) @rm -f extras/keymap/keymap$(EXEEXT) $(AM_V_CCLD)$(LINK) $(extras_keymap_keymap_OBJECTS) $(extras_keymap_keymap_LDADD) $(LIBS) -extras/mobile-action-modeswitch/$(am__dirstamp): - @$(MKDIR_P) extras/mobile-action-modeswitch - @: > extras/mobile-action-modeswitch/$(am__dirstamp) -extras/mobile-action-modeswitch/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) extras/mobile-action-modeswitch/$(DEPDIR) - @: > extras/mobile-action-modeswitch/$(DEPDIR)/$(am__dirstamp) -extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.$(OBJEXT): \ - extras/mobile-action-modeswitch/$(am__dirstamp) \ - extras/mobile-action-modeswitch/$(DEPDIR)/$(am__dirstamp) -extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.$(OBJEXT): \ - extras/mobile-action-modeswitch/$(am__dirstamp) \ - extras/mobile-action-modeswitch/$(DEPDIR)/$(am__dirstamp) -extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.$(OBJEXT): \ - extras/mobile-action-modeswitch/$(am__dirstamp) \ - extras/mobile-action-modeswitch/$(DEPDIR)/$(am__dirstamp) -extras/mobile-action-modeswitch/mobile-action-modeswitch$(EXEEXT): $(extras_mobile_action_modeswitch_mobile_action_modeswitch_OBJECTS) $(extras_mobile_action_modeswitch_mobile_action_modeswitch_DEPENDENCIES) extras/mobile-action-modeswitch/$(am__dirstamp) - @rm -f extras/mobile-action-modeswitch/mobile-action-modeswitch$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(extras_mobile_action_modeswitch_mobile_action_modeswitch_OBJECTS) $(extras_mobile_action_modeswitch_mobile_action_modeswitch_LDADD) $(LIBS) extras/mtd_probe/$(am__dirstamp): @$(MKDIR_P) extras/mtd_probe @: > extras/mtd_probe/$(am__dirstamp) @@ -1542,17 +1468,6 @@ extras/mtd_probe/extras_mtd_probe_mtd_probe-probe_smartmedia.$(OBJEXT): \ extras/mtd_probe/mtd_probe$(EXEEXT): $(extras_mtd_probe_mtd_probe_OBJECTS) $(extras_mtd_probe_mtd_probe_DEPENDENCIES) extras/mtd_probe/$(am__dirstamp) @rm -f extras/mtd_probe/mtd_probe$(EXEEXT) $(AM_V_CCLD)$(LINK) $(extras_mtd_probe_mtd_probe_OBJECTS) $(extras_mtd_probe_mtd_probe_LDADD) $(LIBS) -extras/path_id/$(am__dirstamp): - @$(MKDIR_P) extras/path_id - @: > extras/path_id/$(am__dirstamp) -extras/path_id/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) extras/path_id/$(DEPDIR) - @: > extras/path_id/$(DEPDIR)/$(am__dirstamp) -extras/path_id/path_id.$(OBJEXT): extras/path_id/$(am__dirstamp) \ - extras/path_id/$(DEPDIR)/$(am__dirstamp) -extras/path_id/path_id$(EXEEXT): $(extras_path_id_path_id_OBJECTS) $(extras_path_id_path_id_DEPENDENCIES) extras/path_id/$(am__dirstamp) - @rm -f extras/path_id/path_id$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(extras_path_id_path_id_OBJECTS) $(extras_path_id_path_id_LDADD) $(LIBS) extras/scsi_id/$(am__dirstamp): @$(MKDIR_P) extras/scsi_id @: > extras/scsi_id/$(am__dirstamp) @@ -1596,17 +1511,6 @@ extras/usb-db/extras_usb_db_usb_db-usb-db.$(OBJEXT): \ extras/usb-db/usb-db$(EXEEXT): $(extras_usb_db_usb_db_OBJECTS) $(extras_usb_db_usb_db_DEPENDENCIES) extras/usb-db/$(am__dirstamp) @rm -f extras/usb-db/usb-db$(EXEEXT) $(AM_V_CCLD)$(LINK) $(extras_usb_db_usb_db_OBJECTS) $(extras_usb_db_usb_db_LDADD) $(LIBS) -extras/usb_id/$(am__dirstamp): - @$(MKDIR_P) extras/usb_id - @: > extras/usb_id/$(am__dirstamp) -extras/usb_id/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) extras/usb_id/$(DEPDIR) - @: > extras/usb_id/$(DEPDIR)/$(am__dirstamp) -extras/usb_id/usb_id.$(OBJEXT): extras/usb_id/$(am__dirstamp) \ - extras/usb_id/$(DEPDIR)/$(am__dirstamp) -extras/usb_id/usb_id$(EXEEXT): $(extras_usb_id_usb_id_OBJECTS) $(extras_usb_id_usb_id_DEPENDENCIES) extras/usb_id/$(am__dirstamp) - @rm -f extras/usb_id/usb_id$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(extras_usb_id_usb_id_OBJECTS) $(extras_usb_id_usb_id_LDADD) $(LIBS) extras/v4l_id/$(am__dirstamp): @$(MKDIR_P) extras/v4l_id @: > extras/v4l_id/$(am__dirstamp) @@ -1637,6 +1541,16 @@ udev/udev-node.$(OBJEXT): udev/$(am__dirstamp) \ udev/$(DEPDIR)/$(am__dirstamp) udev/udev-rules.$(OBJEXT): udev/$(am__dirstamp) \ udev/$(DEPDIR)/$(am__dirstamp) +udev/udev-ctrl.$(OBJEXT): udev/$(am__dirstamp) \ + udev/$(DEPDIR)/$(am__dirstamp) +udev/udev-builtin.$(OBJEXT): udev/$(am__dirstamp) \ + udev/$(DEPDIR)/$(am__dirstamp) +udev/udev-builtin-path_id.$(OBJEXT): udev/$(am__dirstamp) \ + udev/$(DEPDIR)/$(am__dirstamp) +udev/udev-builtin-usb_id.$(OBJEXT): udev/$(am__dirstamp) \ + udev/$(DEPDIR)/$(am__dirstamp) +udev/udev-builtin-input_id.$(OBJEXT): udev/$(am__dirstamp) \ + udev/$(DEPDIR)/$(am__dirstamp) udev/test-udev.$(OBJEXT): udev/$(am__dirstamp) \ udev/$(DEPDIR)/$(am__dirstamp) udev/test-udev$(EXEEXT): $(udev_test_udev_OBJECTS) $(udev_test_udev_DEPENDENCIES) udev/$(am__dirstamp) @@ -1648,14 +1562,16 @@ udev/udevadm-info.$(OBJEXT): udev/$(am__dirstamp) \ udev/$(DEPDIR)/$(am__dirstamp) udev/udevadm-control.$(OBJEXT): udev/$(am__dirstamp) \ udev/$(DEPDIR)/$(am__dirstamp) -udev/udevadm-test.$(OBJEXT): udev/$(am__dirstamp) \ - udev/$(DEPDIR)/$(am__dirstamp) udev/udevadm-monitor.$(OBJEXT): udev/$(am__dirstamp) \ udev/$(DEPDIR)/$(am__dirstamp) udev/udevadm-settle.$(OBJEXT): udev/$(am__dirstamp) \ udev/$(DEPDIR)/$(am__dirstamp) udev/udevadm-trigger.$(OBJEXT): udev/$(am__dirstamp) \ udev/$(DEPDIR)/$(am__dirstamp) +udev/udevadm-test.$(OBJEXT): udev/$(am__dirstamp) \ + udev/$(DEPDIR)/$(am__dirstamp) +udev/udevadm-test-builtin.$(OBJEXT): udev/$(am__dirstamp) \ + udev/$(DEPDIR)/$(am__dirstamp) udev/udevadm$(EXEEXT): $(udev_udevadm_OBJECTS) $(udev_udevadm_DEPENDENCIES) udev/$(am__dirstamp) @rm -f udev/udevadm$(EXEEXT) $(AM_V_CCLD)$(LINK) $(udev_udevadm_OBJECTS) $(udev_udevadm_LDADD) $(LIBS) @@ -1703,13 +1619,13 @@ uninstall-dist_libexecSCRIPTS: mostlyclean-compile: -rm -f *.$(OBJEXT) + -rm -f extras/accelerometer/accelerometer.$(OBJEXT) -rm -f extras/ata_id/ata_id.$(OBJEXT) -rm -f extras/cdrom_id/cdrom_id.$(OBJEXT) -rm -f extras/collect/collect.$(OBJEXT) -rm -f extras/edd_id/edd_id.$(OBJEXT) -rm -f extras/firmware/extras_firmware_firmware-firmware.$(OBJEXT) -rm -f extras/floppy/create_floppy_devices.$(OBJEXT) - -rm -f extras/fstab_import/fstab_import.$(OBJEXT) -rm -f extras/gudev/extras_gudev_libgudev_1_0_la-gudevclient.$(OBJEXT) -rm -f extras/gudev/extras_gudev_libgudev_1_0_la-gudevclient.lo -rm -f extras/gudev/extras_gudev_libgudev_1_0_la-gudevdevice.$(OBJEXT) @@ -1720,24 +1636,15 @@ mostlyclean-compile: -rm -f extras/gudev/extras_gudev_libgudev_1_0_la-gudevenumtypes.lo -rm -f extras/gudev/extras_gudev_libgudev_1_0_la-gudevmarshal.$(OBJEXT) -rm -f extras/gudev/extras_gudev_libgudev_1_0_la-gudevmarshal.lo - -rm -f extras/hid2hci/extras_hid2hci_hid2hci-hid2hci.$(OBJEXT) - -rm -f extras/input_id/input_id.$(OBJEXT) -rm -f extras/keymap/extras_keymap_keymap-keymap.$(OBJEXT) - -rm -f extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.$(OBJEXT) - -rm -f extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.$(OBJEXT) - -rm -f extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.$(OBJEXT) -rm -f extras/mtd_probe/extras_mtd_probe_mtd_probe-mtd_probe.$(OBJEXT) -rm -f extras/mtd_probe/extras_mtd_probe_mtd_probe-probe_smartmedia.$(OBJEXT) - -rm -f extras/path_id/path_id.$(OBJEXT) -rm -f extras/scsi_id/scsi_id.$(OBJEXT) -rm -f extras/scsi_id/scsi_serial.$(OBJEXT) -rm -f extras/udev-acl/extras_udev_acl_udev_acl-udev-acl.$(OBJEXT) -rm -f extras/usb-db/extras_usb_db_pci_db-usb-db.$(OBJEXT) -rm -f extras/usb-db/extras_usb_db_usb_db-usb-db.$(OBJEXT) - -rm -f extras/usb_id/usb_id.$(OBJEXT) -rm -f extras/v4l_id/v4l_id.$(OBJEXT) - -rm -f libudev/libudev-ctrl.$(OBJEXT) - -rm -f libudev/libudev-ctrl.lo -rm -f libudev/libudev-device-private.$(OBJEXT) -rm -f libudev/libudev-device-private.lo -rm -f libudev/libudev-device.$(OBJEXT) @@ -1763,6 +1670,11 @@ mostlyclean-compile: -rm -f libudev/test-libudev.$(OBJEXT) -rm -f udev/sd-daemon.$(OBJEXT) -rm -f udev/test-udev.$(OBJEXT) + -rm -f udev/udev-builtin-input_id.$(OBJEXT) + -rm -f udev/udev-builtin-path_id.$(OBJEXT) + -rm -f udev/udev-builtin-usb_id.$(OBJEXT) + -rm -f udev/udev-builtin.$(OBJEXT) + -rm -f udev/udev-ctrl.$(OBJEXT) -rm -f udev/udev-event.$(OBJEXT) -rm -f udev/udev-node.$(OBJEXT) -rm -f udev/udev-rules.$(OBJEXT) @@ -1771,6 +1683,7 @@ mostlyclean-compile: -rm -f udev/udevadm-info.$(OBJEXT) -rm -f udev/udevadm-monitor.$(OBJEXT) -rm -f udev/udevadm-settle.$(OBJEXT) + -rm -f udev/udevadm-test-builtin.$(OBJEXT) -rm -f udev/udevadm-test.$(OBJEXT) -rm -f udev/udevadm-trigger.$(OBJEXT) -rm -f udev/udevadm.$(OBJEXT) @@ -1779,35 +1692,27 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@extras/accelerometer/$(DEPDIR)/accelerometer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/ata_id/$(DEPDIR)/ata_id.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/cdrom_id/$(DEPDIR)/cdrom_id.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/collect/$(DEPDIR)/collect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/edd_id/$(DEPDIR)/edd_id.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/firmware/$(DEPDIR)/extras_firmware_firmware-firmware.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/floppy/$(DEPDIR)/create_floppy_devices.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@extras/fstab_import/$(DEPDIR)/fstab_import.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/gudev/$(DEPDIR)/extras_gudev_libgudev_1_0_la-gudevclient.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/gudev/$(DEPDIR)/extras_gudev_libgudev_1_0_la-gudevdevice.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/gudev/$(DEPDIR)/extras_gudev_libgudev_1_0_la-gudevenumerator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/gudev/$(DEPDIR)/extras_gudev_libgudev_1_0_la-gudevenumtypes.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/gudev/$(DEPDIR)/extras_gudev_libgudev_1_0_la-gudevmarshal.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@extras/hid2hci/$(DEPDIR)/extras_hid2hci_hid2hci-hid2hci.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@extras/input_id/$(DEPDIR)/input_id.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/keymap/$(DEPDIR)/extras_keymap_keymap-keymap.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/mtd_probe/$(DEPDIR)/extras_mtd_probe_mtd_probe-mtd_probe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/mtd_probe/$(DEPDIR)/extras_mtd_probe_mtd_probe-probe_smartmedia.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@extras/path_id/$(DEPDIR)/path_id.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/scsi_id/$(DEPDIR)/scsi_id.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/scsi_id/$(DEPDIR)/scsi_serial.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/udev-acl/$(DEPDIR)/extras_udev_acl_udev_acl-udev-acl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/usb-db/$(DEPDIR)/extras_usb_db_pci_db-usb-db.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/usb-db/$(DEPDIR)/extras_usb_db_usb_db-usb-db.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@extras/usb_id/$(DEPDIR)/usb_id.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@extras/v4l_id/$(DEPDIR)/v4l_id.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@libudev/$(DEPDIR)/libudev-ctrl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libudev/$(DEPDIR)/libudev-device-private.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libudev/$(DEPDIR)/libudev-device.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libudev/$(DEPDIR)/libudev-enumerate.Plo@am__quote@ @@ -1822,6 +1727,11 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@libudev/$(DEPDIR)/test-libudev.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@udev/$(DEPDIR)/sd-daemon.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@udev/$(DEPDIR)/test-udev.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@udev/$(DEPDIR)/udev-builtin-input_id.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@udev/$(DEPDIR)/udev-builtin-path_id.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@udev/$(DEPDIR)/udev-builtin-usb_id.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@udev/$(DEPDIR)/udev-builtin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@udev/$(DEPDIR)/udev-ctrl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@udev/$(DEPDIR)/udev-event.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@udev/$(DEPDIR)/udev-node.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@udev/$(DEPDIR)/udev-rules.Po@am__quote@ @@ -1830,6 +1740,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@udev/$(DEPDIR)/udevadm-info.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@udev/$(DEPDIR)/udevadm-monitor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@udev/$(DEPDIR)/udevadm-settle.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@udev/$(DEPDIR)/udevadm-test-builtin.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@udev/$(DEPDIR)/udevadm-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@udev/$(DEPDIR)/udevadm-trigger.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@udev/$(DEPDIR)/udevadm.Po@am__quote@ @@ -1918,22 +1829,6 @@ extras/firmware/extras_firmware_firmware-firmware.obj: extras/firmware/firmware. @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_firmware_firmware_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o extras/firmware/extras_firmware_firmware-firmware.obj `if test -f 'extras/firmware/firmware.c'; then $(CYGPATH_W) 'extras/firmware/firmware.c'; else $(CYGPATH_W) '$(srcdir)/extras/firmware/firmware.c'; fi` -extras/hid2hci/extras_hid2hci_hid2hci-hid2hci.o: extras/hid2hci/hid2hci.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_hid2hci_hid2hci_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT extras/hid2hci/extras_hid2hci_hid2hci-hid2hci.o -MD -MP -MF extras/hid2hci/$(DEPDIR)/extras_hid2hci_hid2hci-hid2hci.Tpo -c -o extras/hid2hci/extras_hid2hci_hid2hci-hid2hci.o `test -f 'extras/hid2hci/hid2hci.c' || echo '$(srcdir)/'`extras/hid2hci/hid2hci.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) extras/hid2hci/$(DEPDIR)/extras_hid2hci_hid2hci-hid2hci.Tpo extras/hid2hci/$(DEPDIR)/extras_hid2hci_hid2hci-hid2hci.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='extras/hid2hci/hid2hci.c' object='extras/hid2hci/extras_hid2hci_hid2hci-hid2hci.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_hid2hci_hid2hci_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o extras/hid2hci/extras_hid2hci_hid2hci-hid2hci.o `test -f 'extras/hid2hci/hid2hci.c' || echo '$(srcdir)/'`extras/hid2hci/hid2hci.c - -extras/hid2hci/extras_hid2hci_hid2hci-hid2hci.obj: extras/hid2hci/hid2hci.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_hid2hci_hid2hci_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT extras/hid2hci/extras_hid2hci_hid2hci-hid2hci.obj -MD -MP -MF extras/hid2hci/$(DEPDIR)/extras_hid2hci_hid2hci-hid2hci.Tpo -c -o extras/hid2hci/extras_hid2hci_hid2hci-hid2hci.obj `if test -f 'extras/hid2hci/hid2hci.c'; then $(CYGPATH_W) 'extras/hid2hci/hid2hci.c'; else $(CYGPATH_W) '$(srcdir)/extras/hid2hci/hid2hci.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) extras/hid2hci/$(DEPDIR)/extras_hid2hci_hid2hci-hid2hci.Tpo extras/hid2hci/$(DEPDIR)/extras_hid2hci_hid2hci-hid2hci.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='extras/hid2hci/hid2hci.c' object='extras/hid2hci/extras_hid2hci_hid2hci-hid2hci.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_hid2hci_hid2hci_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o extras/hid2hci/extras_hid2hci_hid2hci-hid2hci.obj `if test -f 'extras/hid2hci/hid2hci.c'; then $(CYGPATH_W) 'extras/hid2hci/hid2hci.c'; else $(CYGPATH_W) '$(srcdir)/extras/hid2hci/hid2hci.c'; fi` - extras/keymap/extras_keymap_keymap-keymap.o: extras/keymap/keymap.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_keymap_keymap_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT extras/keymap/extras_keymap_keymap-keymap.o -MD -MP -MF extras/keymap/$(DEPDIR)/extras_keymap_keymap-keymap.Tpo -c -o extras/keymap/extras_keymap_keymap-keymap.o `test -f 'extras/keymap/keymap.c' || echo '$(srcdir)/'`extras/keymap/keymap.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) extras/keymap/$(DEPDIR)/extras_keymap_keymap-keymap.Tpo extras/keymap/$(DEPDIR)/extras_keymap_keymap-keymap.Po @@ -1950,54 +1845,6 @@ extras/keymap/extras_keymap_keymap-keymap.obj: extras/keymap/keymap.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_keymap_keymap_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o extras/keymap/extras_keymap_keymap-keymap.obj `if test -f 'extras/keymap/keymap.c'; then $(CYGPATH_W) 'extras/keymap/keymap.c'; else $(CYGPATH_W) '$(srcdir)/extras/keymap/keymap.c'; fi` -extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.o: extras/mobile-action-modeswitch/mobile-action-modeswitch.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.o -MD -MP -MF extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.Tpo -c -o extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.o `test -f 'extras/mobile-action-modeswitch/mobile-action-modeswitch.c' || echo '$(srcdir)/'`extras/mobile-action-modeswitch/mobile-action-modeswitch.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.Tpo extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='extras/mobile-action-modeswitch/mobile-action-modeswitch.c' object='extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.o `test -f 'extras/mobile-action-modeswitch/mobile-action-modeswitch.c' || echo '$(srcdir)/'`extras/mobile-action-modeswitch/mobile-action-modeswitch.c - -extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.obj: extras/mobile-action-modeswitch/mobile-action-modeswitch.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.obj -MD -MP -MF extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.Tpo -c -o extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.obj `if test -f 'extras/mobile-action-modeswitch/mobile-action-modeswitch.c'; then $(CYGPATH_W) 'extras/mobile-action-modeswitch/mobile-action-modeswitch.c'; else $(CYGPATH_W) '$(srcdir)/extras/mobile-action-modeswitch/mobile-action-modeswitch.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.Tpo extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='extras/mobile-action-modeswitch/mobile-action-modeswitch.c' object='extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-mobile-action-modeswitch.obj `if test -f 'extras/mobile-action-modeswitch/mobile-action-modeswitch.c'; then $(CYGPATH_W) 'extras/mobile-action-modeswitch/mobile-action-modeswitch.c'; else $(CYGPATH_W) '$(srcdir)/extras/mobile-action-modeswitch/mobile-action-modeswitch.c'; fi` - -extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.o: extras/mobile-action-modeswitch/utils.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.o -MD -MP -MF extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.Tpo -c -o extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.o `test -f 'extras/mobile-action-modeswitch/utils.c' || echo '$(srcdir)/'`extras/mobile-action-modeswitch/utils.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.Tpo extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='extras/mobile-action-modeswitch/utils.c' object='extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.o `test -f 'extras/mobile-action-modeswitch/utils.c' || echo '$(srcdir)/'`extras/mobile-action-modeswitch/utils.c - -extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.obj: extras/mobile-action-modeswitch/utils.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.obj -MD -MP -MF extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.Tpo -c -o extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.obj `if test -f 'extras/mobile-action-modeswitch/utils.c'; then $(CYGPATH_W) 'extras/mobile-action-modeswitch/utils.c'; else $(CYGPATH_W) '$(srcdir)/extras/mobile-action-modeswitch/utils.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.Tpo extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='extras/mobile-action-modeswitch/utils.c' object='extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-utils.obj `if test -f 'extras/mobile-action-modeswitch/utils.c'; then $(CYGPATH_W) 'extras/mobile-action-modeswitch/utils.c'; else $(CYGPATH_W) '$(srcdir)/extras/mobile-action-modeswitch/utils.c'; fi` - -extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.o: extras/mobile-action-modeswitch/ma8280p_us.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.o -MD -MP -MF extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.Tpo -c -o extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.o `test -f 'extras/mobile-action-modeswitch/ma8280p_us.c' || echo '$(srcdir)/'`extras/mobile-action-modeswitch/ma8280p_us.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.Tpo extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='extras/mobile-action-modeswitch/ma8280p_us.c' object='extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.o `test -f 'extras/mobile-action-modeswitch/ma8280p_us.c' || echo '$(srcdir)/'`extras/mobile-action-modeswitch/ma8280p_us.c - -extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.obj: extras/mobile-action-modeswitch/ma8280p_us.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.obj -MD -MP -MF extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.Tpo -c -o extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.obj `if test -f 'extras/mobile-action-modeswitch/ma8280p_us.c'; then $(CYGPATH_W) 'extras/mobile-action-modeswitch/ma8280p_us.c'; else $(CYGPATH_W) '$(srcdir)/extras/mobile-action-modeswitch/ma8280p_us.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.Tpo extras/mobile-action-modeswitch/$(DEPDIR)/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='extras/mobile-action-modeswitch/ma8280p_us.c' object='extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o extras/mobile-action-modeswitch/extras_mobile_action_modeswitch_mobile_action_modeswitch-ma8280p_us.obj `if test -f 'extras/mobile-action-modeswitch/ma8280p_us.c'; then $(CYGPATH_W) 'extras/mobile-action-modeswitch/ma8280p_us.c'; else $(CYGPATH_W) '$(srcdir)/extras/mobile-action-modeswitch/ma8280p_us.c'; fi` - extras/mtd_probe/extras_mtd_probe_mtd_probe-mtd_probe.o: extras/mtd_probe/mtd_probe.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(extras_mtd_probe_mtd_probe_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT extras/mtd_probe/extras_mtd_probe_mtd_probe-mtd_probe.o -MD -MP -MF extras/mtd_probe/$(DEPDIR)/extras_mtd_probe_mtd_probe-mtd_probe.Tpo -c -o extras/mtd_probe/extras_mtd_probe_mtd_probe-mtd_probe.o `test -f 'extras/mtd_probe/mtd_probe.c' || echo '$(srcdir)/'`extras/mtd_probe/mtd_probe.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) extras/mtd_probe/$(DEPDIR)/extras_mtd_probe_mtd_probe-mtd_probe.Tpo extras/mtd_probe/$(DEPDIR)/extras_mtd_probe_mtd_probe-mtd_probe.Po @@ -2083,24 +1930,19 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs + -rm -rf extras/accelerometer/.libs extras/accelerometer/_libs -rm -rf extras/ata_id/.libs extras/ata_id/_libs -rm -rf extras/cdrom_id/.libs extras/cdrom_id/_libs -rm -rf extras/collect/.libs extras/collect/_libs -rm -rf extras/edd_id/.libs extras/edd_id/_libs -rm -rf extras/firmware/.libs extras/firmware/_libs -rm -rf extras/floppy/.libs extras/floppy/_libs - -rm -rf extras/fstab_import/.libs extras/fstab_import/_libs -rm -rf extras/gudev/.libs extras/gudev/_libs - -rm -rf extras/hid2hci/.libs extras/hid2hci/_libs - -rm -rf extras/input_id/.libs extras/input_id/_libs -rm -rf extras/keymap/.libs extras/keymap/_libs - -rm -rf extras/mobile-action-modeswitch/.libs extras/mobile-action-modeswitch/_libs -rm -rf extras/mtd_probe/.libs extras/mtd_probe/_libs - -rm -rf extras/path_id/.libs extras/path_id/_libs -rm -rf extras/scsi_id/.libs extras/scsi_id/_libs -rm -rf extras/udev-acl/.libs extras/udev-acl/_libs -rm -rf extras/usb-db/.libs extras/usb-db/_libs - -rm -rf extras/usb_id/.libs extras/usb_id/_libs -rm -rf extras/v4l_id/.libs extras/v4l_id/_libs -rm -rf libudev/.libs libudev/_libs -rm -rf udev/.libs udev/_libs @@ -2901,6 +2743,8 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f extras/accelerometer/$(DEPDIR)/$(am__dirstamp) + -rm -f extras/accelerometer/$(am__dirstamp) -rm -f extras/ata_id/$(DEPDIR)/$(am__dirstamp) -rm -f extras/ata_id/$(am__dirstamp) -rm -f extras/cdrom_id/$(DEPDIR)/$(am__dirstamp) @@ -2913,30 +2757,18 @@ distclean-generic: -rm -f extras/firmware/$(am__dirstamp) -rm -f extras/floppy/$(DEPDIR)/$(am__dirstamp) -rm -f extras/floppy/$(am__dirstamp) - -rm -f extras/fstab_import/$(DEPDIR)/$(am__dirstamp) - -rm -f extras/fstab_import/$(am__dirstamp) -rm -f extras/gudev/$(DEPDIR)/$(am__dirstamp) -rm -f extras/gudev/$(am__dirstamp) - -rm -f extras/hid2hci/$(DEPDIR)/$(am__dirstamp) - -rm -f extras/hid2hci/$(am__dirstamp) - -rm -f extras/input_id/$(DEPDIR)/$(am__dirstamp) - -rm -f extras/input_id/$(am__dirstamp) -rm -f extras/keymap/$(DEPDIR)/$(am__dirstamp) -rm -f extras/keymap/$(am__dirstamp) - -rm -f extras/mobile-action-modeswitch/$(DEPDIR)/$(am__dirstamp) - -rm -f extras/mobile-action-modeswitch/$(am__dirstamp) -rm -f extras/mtd_probe/$(DEPDIR)/$(am__dirstamp) -rm -f extras/mtd_probe/$(am__dirstamp) - -rm -f extras/path_id/$(DEPDIR)/$(am__dirstamp) - -rm -f extras/path_id/$(am__dirstamp) -rm -f extras/scsi_id/$(DEPDIR)/$(am__dirstamp) -rm -f extras/scsi_id/$(am__dirstamp) -rm -f extras/udev-acl/$(DEPDIR)/$(am__dirstamp) -rm -f extras/udev-acl/$(am__dirstamp) -rm -f extras/usb-db/$(DEPDIR)/$(am__dirstamp) -rm -f extras/usb-db/$(am__dirstamp) - -rm -f extras/usb_id/$(DEPDIR)/$(am__dirstamp) - -rm -f extras/usb_id/$(am__dirstamp) -rm -f extras/v4l_id/$(DEPDIR)/$(am__dirstamp) -rm -f extras/v4l_id/$(am__dirstamp) -rm -f libudev/$(DEPDIR)/$(am__dirstamp) @@ -2956,7 +2788,7 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \ distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf extras/ata_id/$(DEPDIR) extras/cdrom_id/$(DEPDIR) extras/collect/$(DEPDIR) extras/edd_id/$(DEPDIR) extras/firmware/$(DEPDIR) extras/floppy/$(DEPDIR) extras/fstab_import/$(DEPDIR) extras/gudev/$(DEPDIR) extras/hid2hci/$(DEPDIR) extras/input_id/$(DEPDIR) extras/keymap/$(DEPDIR) extras/mobile-action-modeswitch/$(DEPDIR) extras/mtd_probe/$(DEPDIR) extras/path_id/$(DEPDIR) extras/scsi_id/$(DEPDIR) extras/udev-acl/$(DEPDIR) extras/usb-db/$(DEPDIR) extras/usb_id/$(DEPDIR) extras/v4l_id/$(DEPDIR) libudev/$(DEPDIR) udev/$(DEPDIR) + -rm -rf extras/accelerometer/$(DEPDIR) extras/ata_id/$(DEPDIR) extras/cdrom_id/$(DEPDIR) extras/collect/$(DEPDIR) extras/edd_id/$(DEPDIR) extras/firmware/$(DEPDIR) extras/floppy/$(DEPDIR) extras/gudev/$(DEPDIR) extras/keymap/$(DEPDIR) extras/mtd_probe/$(DEPDIR) extras/scsi_id/$(DEPDIR) extras/udev-acl/$(DEPDIR) extras/usb-db/$(DEPDIR) extras/v4l_id/$(DEPDIR) libudev/$(DEPDIR) udev/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-local distclean-tags @@ -3013,7 +2845,7 @@ installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf extras/ata_id/$(DEPDIR) extras/cdrom_id/$(DEPDIR) extras/collect/$(DEPDIR) extras/edd_id/$(DEPDIR) extras/firmware/$(DEPDIR) extras/floppy/$(DEPDIR) extras/fstab_import/$(DEPDIR) extras/gudev/$(DEPDIR) extras/hid2hci/$(DEPDIR) extras/input_id/$(DEPDIR) extras/keymap/$(DEPDIR) extras/mobile-action-modeswitch/$(DEPDIR) extras/mtd_probe/$(DEPDIR) extras/path_id/$(DEPDIR) extras/scsi_id/$(DEPDIR) extras/udev-acl/$(DEPDIR) extras/usb-db/$(DEPDIR) extras/usb_id/$(DEPDIR) extras/v4l_id/$(DEPDIR) libudev/$(DEPDIR) udev/$(DEPDIR) + -rm -rf extras/accelerometer/$(DEPDIR) extras/ata_id/$(DEPDIR) extras/cdrom_id/$(DEPDIR) extras/collect/$(DEPDIR) extras/edd_id/$(DEPDIR) extras/firmware/$(DEPDIR) extras/floppy/$(DEPDIR) extras/gudev/$(DEPDIR) extras/keymap/$(DEPDIR) extras/mtd_probe/$(DEPDIR) extras/scsi_id/$(DEPDIR) extras/udev-acl/$(DEPDIR) extras/usb-db/$(DEPDIR) extras/v4l_id/$(DEPDIR) libudev/$(DEPDIR) udev/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -3109,10 +2941,12 @@ udev-confdirs: -mkdir -p $(DESTDIR)$(libexecdir)/devices @WITH_SYSTEMD_TRUE@systemd-install-hook: +@WITH_SYSTEMD_TRUE@ mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants +@WITH_SYSTEMD_TRUE@ ln -sf ../udev-control.socket $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants/udev-control.socket +@WITH_SYSTEMD_TRUE@ ln -sf ../udev-kernel.socket $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants/udev-kernel.socket @WITH_SYSTEMD_TRUE@ mkdir -p $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants @WITH_SYSTEMD_TRUE@ ln -sf ../udev.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev.service -@WITH_SYSTEMD_TRUE@ ln -sf ../udev-settle.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev-settle.service -@WITH_SYSTEMD_TRUE@ ln -sf ../udev-retry.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev-retry.service +@WITH_SYSTEMD_TRUE@ ln -sf ../udev-trigger.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev-trigger.service udev/%.7 udev/%.8 : udev/%.xml $(AM_V_GEN)$(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< @@ -3120,83 +2954,83 @@ udev/%.7 udev/%.8 : udev/%.xml udev/%.html : udev/%.xml $(AM_V_GEN)$(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/xhtml-1_1/docbook.xsl $< -@ENABLE_EXTRAS_TRUE@extras/gudev/gudevmarshal.h: extras/gudev/gudevmarshal.list -@ENABLE_EXTRAS_TRUE@ $(AM_V_GEN)glib-genmarshal $< --prefix=g_udev_marshal --header > $@ - -@ENABLE_EXTRAS_TRUE@extras/gudev/gudevmarshal.c: extras/gudev/gudevmarshal.list -@ENABLE_EXTRAS_TRUE@ $(AM_V_GEN)echo "#include \"gudevmarshal.h\"" > $@ && \ -@ENABLE_EXTRAS_TRUE@ glib-genmarshal $< --prefix=g_udev_marshal --body >> $@ - -@ENABLE_EXTRAS_TRUE@extras/gudev/gudevenumtypes.h: extras/gudev/gudevenumtypes.h.template extras/gudev/gudevenums.h -@ENABLE_EXTRAS_TRUE@ $(AM_V_GEN)glib-mkenums --template $^ > \ -@ENABLE_EXTRAS_TRUE@ $@.tmp && mv $@.tmp $@ - -@ENABLE_EXTRAS_TRUE@extras/gudev/gudevenumtypes.c: extras/gudev/gudevenumtypes.c.template extras/gudev/gudevenums.h -@ENABLE_EXTRAS_TRUE@ $(AM_V_GEN)glib-mkenums --template $^ > \ -@ENABLE_EXTRAS_TRUE@ $@.tmp && mv $@.tmp $@ - -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefile.am -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(AM_V_GEN)PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ LD_LIBRARY_PATH=$(top_builddir)/extras/gudev:$$LD_LIBRARY_PATH \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(G_IR_SCANNER) -v \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ --namespace GUdev \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ --nsversion=1.0 \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ --include=GObject-2.0 \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ --library=gudev-1.0 \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ --library-path=extras/gudev \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ --output $@ \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ --pkg=glib-2.0 \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ --pkg=gobject-2.0 \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ -I$(top_builddir)/extras \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ -I$(top_srcdir)/extras \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ -D_GUDEV_COMPILATION \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ -D_GUDEV_WORK_AROUND_DEV_T_BUG \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudev.h \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudevtypes.h \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudevenums.h \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(or $(wildcard $(top_builddir)/extras/gudev/gudevenumtypes.h),$(top_srcdir)/extras/gudev/gudevenumtypes.h) \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudevclient.h \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudevdevice.h \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudevenumerator.h \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudevclient.c \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudevdevice.c \ -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudevenumerator.c - -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@extras/gudev/GUdev-1.0.typelib: extras/gudev/GUdev-1.0.gir $(G_IR_COMPILER) -@ENABLE_EXTRAS_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(AM_V_GEN)g-ir-compiler $< -o $@ +@ENABLE_GUDEV_TRUE@extras/gudev/gudevmarshal.h: extras/gudev/gudevmarshal.list +@ENABLE_GUDEV_TRUE@ $(AM_V_GEN)glib-genmarshal $< --prefix=g_udev_marshal --header > $@ + +@ENABLE_GUDEV_TRUE@extras/gudev/gudevmarshal.c: extras/gudev/gudevmarshal.list +@ENABLE_GUDEV_TRUE@ $(AM_V_GEN)echo "#include \"gudevmarshal.h\"" > $@ && \ +@ENABLE_GUDEV_TRUE@ glib-genmarshal $< --prefix=g_udev_marshal --body >> $@ + +@ENABLE_GUDEV_TRUE@extras/gudev/gudevenumtypes.h: extras/gudev/gudevenumtypes.h.template extras/gudev/gudevenums.h +@ENABLE_GUDEV_TRUE@ $(AM_V_GEN)glib-mkenums --template $^ > \ +@ENABLE_GUDEV_TRUE@ $@.tmp && mv $@.tmp $@ + +@ENABLE_GUDEV_TRUE@extras/gudev/gudevenumtypes.c: extras/gudev/gudevenumtypes.c.template extras/gudev/gudevenums.h +@ENABLE_GUDEV_TRUE@ $(AM_V_GEN)glib-mkenums --template $^ > \ +@ENABLE_GUDEV_TRUE@ $@.tmp && mv $@.tmp $@ + +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(AM_V_GEN)$(G_IR_SCANNER) -v \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ --warn-all \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ --namespace GUdev \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ --nsversion=1.0 \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ --include=GObject-2.0 \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ --library=gudev-1.0 \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ --library-path=$(top_builddir)/libudev \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ --library-path=$(top_builddir)/extras/gudev \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ --output $@ \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ --pkg=glib-2.0 \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ --pkg=gobject-2.0 \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ -I$(top_srcdir)/extras \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ -I$(top_builddir)/extras \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ -D_GUDEV_COMPILATION \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ -D_GUDEV_WORK_AROUND_DEV_T_BUG \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudev.h \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudevtypes.h \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudevenums.h \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(or $(wildcard $(top_builddir)/extras/gudev/gudevenumtypes.h),$(top_srcdir)/extras/gudev/gudevenumtypes.h) \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudevclient.h \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudevdevice.h \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudevenumerator.h \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudevclient.c \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudevdevice.c \ +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(top_srcdir)/extras/gudev/gudevenumerator.c + +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@extras/gudev/GUdev-1.0.typelib: extras/gudev/GUdev-1.0.gir $(G_IR_COMPILER) +@ENABLE_GUDEV_TRUE@@ENABLE_INTROSPECTION_TRUE@ $(AM_V_GEN)g-ir-compiler $< -o $@ # move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed -@ENABLE_EXTRAS_TRUE@libgudev-install-move-hook: -@ENABLE_EXTRAS_TRUE@ if test "$(libdir)" != "$(rootlib_execdir)"; then \ -@ENABLE_EXTRAS_TRUE@ mkdir -p $(DESTDIR)$(rootlib_execdir) && \ -@ENABLE_EXTRAS_TRUE@ so_img_name=$$(readlink $(DESTDIR)$(libdir)/libgudev-1.0.so) && \ -@ENABLE_EXTRAS_TRUE@ so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \ -@ENABLE_EXTRAS_TRUE@ ln -sf $$so_img_rel_target_prefix$(rootlib_execdir)/$$so_img_name $(DESTDIR)$(libdir)/libgudev-1.0.so && \ -@ENABLE_EXTRAS_TRUE@ mv $(DESTDIR)$(libdir)/libgudev-1.0.so.* $(DESTDIR)$(rootlib_execdir); \ -@ENABLE_EXTRAS_TRUE@ fi +@ENABLE_GUDEV_TRUE@libgudev-install-move-hook: +@ENABLE_GUDEV_TRUE@ if test "$(libdir)" != "$(rootlib_execdir)"; then \ +@ENABLE_GUDEV_TRUE@ mkdir -p $(DESTDIR)$(rootlib_execdir) && \ +@ENABLE_GUDEV_TRUE@ so_img_name=$$(readlink $(DESTDIR)$(libdir)/libgudev-1.0.so) && \ +@ENABLE_GUDEV_TRUE@ so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \ +@ENABLE_GUDEV_TRUE@ ln -sf $$so_img_rel_target_prefix$(rootlib_execdir)/$$so_img_name $(DESTDIR)$(libdir)/libgudev-1.0.so && \ +@ENABLE_GUDEV_TRUE@ mv $(DESTDIR)$(libdir)/libgudev-1.0.so.* $(DESTDIR)$(rootlib_execdir); \ +@ENABLE_GUDEV_TRUE@ fi -@ENABLE_EXTRAS_TRUE@libgudev-uninstall-move-hook: -@ENABLE_EXTRAS_TRUE@ rm -f $(DESTDIR)$(rootlib_execdir)/libgudev-1.0.so* +@ENABLE_GUDEV_TRUE@libgudev-uninstall-move-hook: +@ENABLE_GUDEV_TRUE@ rm -f $(DESTDIR)$(rootlib_execdir)/libgudev-1.0.so* -@ENABLE_EXTRAS_TRUE@udevacl-install-hook: -@ENABLE_EXTRAS_TRUE@ mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d -@ENABLE_EXTRAS_TRUE@ ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d/udev-acl.ck +@ENABLE_KEYMAP_TRUE@extras/keymap/keys.txt: $(INCLUDE_PREFIX)/linux/input.h +@ENABLE_KEYMAP_TRUE@ $(AM_V_at)mkdir -p extras/keymap +@ENABLE_KEYMAP_TRUE@ $(AM_V_GEN)$(AWK) '/^#define.*KEY_[^ ]+[ \t]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' < $< | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@ -@ENABLE_EXTRAS_TRUE@extras/keymap/keys.txt: $(INCLUDE_PREFIX)/linux/input.h -@ENABLE_EXTRAS_TRUE@ $(AM_V_at)mkdir -p extras/keymap -@ENABLE_EXTRAS_TRUE@ $(AM_V_GEN)$(AWK) '/^#define.*KEY_[^ ]+[ \t]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' < $< | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@ +@ENABLE_KEYMAP_TRUE@extras/keymap/keys-from-name.gperf: extras/keymap/keys.txt +@ENABLE_KEYMAP_TRUE@ $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' < $< > $@ -@ENABLE_EXTRAS_TRUE@extras/keymap/keys-from-name.gperf: extras/keymap/keys.txt -@ENABLE_EXTRAS_TRUE@ $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' < $< > $@ +@ENABLE_KEYMAP_TRUE@extras/keymap/keys-from-name.h: extras/keymap/keys-from-name.gperf Makefile +@ENABLE_KEYMAP_TRUE@ $(AM_V_GEN)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_key -H hash_key_name -p -C < $< > $@ -@ENABLE_EXTRAS_TRUE@extras/keymap/keys-from-name.h: extras/keymap/keys-from-name.gperf Makefile -@ENABLE_EXTRAS_TRUE@ $(AM_V_GEN)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_key -H hash_key_name -p -C < $< > $@ +@ENABLE_KEYMAP_TRUE@extras/keymap/keys-to-name.h: extras/keymap/keys.txt Makefile +@ENABLE_KEYMAP_TRUE@ $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@ -@ENABLE_EXTRAS_TRUE@extras/keymap/keys-to-name.h: extras/keymap/keys.txt Makefile -@ENABLE_EXTRAS_TRUE@ $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@ +@ENABLE_KEYMAP_TRUE@keymaps-distcheck-hook: extras/keymap/keys.txt +@ENABLE_KEYMAP_TRUE@ $(top_srcdir)/extras/keymap/check-keymaps.sh $(top_srcdir) $^ -@ENABLE_EXTRAS_TRUE@keymaps-distcheck-hook: extras/keymap/keys.txt -@ENABLE_EXTRAS_TRUE@ $(top_srcdir)/extras/keymap/check-keymaps.sh $(top_srcdir) $^ +@ENABLE_UDEV_ACL_TRUE@udevacl-install-hook: +@ENABLE_UDEV_ACL_TRUE@ mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d +@ENABLE_UDEV_ACL_TRUE@ ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d/udev-acl.ck # ------------------------------------------------------------------------------ # install, uninstall, clean hooks @@ -3235,9 +3069,20 @@ git-release: head -1 ChangeLog | grep -q "to v$(VERSION)" head -1 NEWS | grep -q "udev $(VERSION)" git commit -a -m "release $(VERSION)" - cat .git/refs/heads/master > .git/refs/tags/$(VERSION) - git gc - git prune + git tag -m $(VERSION) -s $(VERSION) + git gc --prune=0 + +tar: + make distcheck + gpg --armor --detach-sign udev-$(VERSION).tar.gz + gpg --armor --detach-sign udev-$(VERSION).tar.bz2 + +git-sync: + git push + git push --tags $(VERSION) + +tar-sync: + scp udev-$(VERSION).tar.gz master.kernel.org:/pub/linux/utils/kernel/hotplug/ doc-sync: rsync -av udev/*.html master.kernel.org:/pub/linux/utils/kernel/hotplug/udev/ diff --git a/NEWS b/NEWS index 1797910..f4ad9f0 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,155 @@ +udev 174 +======== +Bugfixes. + +The udev daemon moved to /lib/udev/udevd. Non-systemd init systems +and non-dracut initramfs image generators need to change the init +scripts. Alternatively the udev build needs to move udevd back to +/sbin or create a symlink in /sbin, which is not done by default. + +The path_id, usb_id, input_id tools are built-in commands now and +the stand-alone tools do not exist anymore. Static lists of file in +initramfs generators need to be updated. For testing, the commands +can still be executed standalone with 'udevadm test-builtin '. + +The fusectl filesystem is no longer mounted directly from udev. +Systemd systems will take care of mounting fusectl and configfs +now. Non-systemd systems need to ship their own rule if they +need these filesystems auto-mounted. + +The long deprecated keys: SYSFS=, ID=, BUS= have been removed. + +The support for 'udevadm trigger --type=failed, and the +RUN{fail_event_on_error} attribute was removed. + +The udev control socket is now created in /run/udev/control +and no longer as an abstract namespace one. + +The rules to create persistent network interface and cdrom link +rules automatically in /etc/udev/rules.d/ have been disabled by +default. Explicit configuration will be required for these use +cases, udev will no longer try to write any persistent system +configuration from a device hotplug path. + +udev 173 +======== +Bugfixes. + +The udev-acl extra is no longer enabled by default now. To enable it, +--enable-udev_acl needs to be given at ./configure time. On systemd +systems, the udev-acl rules prevent it from running as the functionality +has moved to systemd. + +udev 172 +======== +Bugfixes. + +Udev now enables kernel media-presence polling if available. Part +of udisks optical drive tray-handling moved to cdrom_id: The tray +is locked as soon as a media is detected to enable the receiving +of media-eject-request events. Media-eject-request events will +eject the media. + +Libudev enumerate is now able to enumerate a subtree of a given +device. + +The mobile-action-modeswitch modeswitch tool was deleted. The +functionality is provided by usb_modeswitch now. + +udev 171 +======== +Bugfixes. + +The systemd service files require systemd version 28. The systemd +socket activation make it possible now to start 'udevd' and 'udevadm +trigger' in parallel. + +udev 170 +======== +Fix bug in control message handling, which can lead to a failing +udevadm control --exit. Thanks to Jürg Billeter for help tracking +it down. + +udev 169 +======== +Bugfixes. + +We require at least Linux kernel 2.6.32 now. Some platforms might +require a later kernel that supports accept4() and similar, or +need to backport the trivial syscall wiring to the older kernels. + +The hid2hci tool moved to the bluez package and was removed. + +Many of the extras can be --enable/--disabled at ./configure +time. The --disable-extras option was removed. Some extras have +been disabled by default. The current options and their defaults +can be checked with './configure --help'. + +udev 168 +======== +Bugfixes. + +Udev logs a warning now if /run is not writable at udevd +startup. It will still fall back to /dev/.udev, but this is +now considered a bug. + +The running udev daemon can now cleanly shut down with: + udevadm control --exit + +Udev in initramfs should clean the state of the udev database +with: udevadm info --cleanup-db which will remove all state left +behind from events/rules in initramfs. If initramfs uses +--cleanup-db and device-mapper/LVM, the rules in initramfs need +to add OPTIONS+="db_persist" for all dm devices. This will +prevent removal of the udev database for these devices. + +Spawned programs by PROGRAM/IMPORT/RUN now have a hard timeout of +120 seconds per process. If that timeout is reached the spawned +process will be killed. The event timeout can be overwritten with +udev rules. + +If systemd is used, udev gets now activated by netlink data. +Systemd will bind the netlink socket which will buffer all data. +If needed, such setup allows a seemless update of the udev daemon, +where no event can be lost during a udevd update/restart. +Packages need to make sure to: systemctl stop udev.socket udev.service +or 'mask' udev.service during the upgrade to prevent any unwanted +auto-spawning of udevd. +This version of udev conflicts with systemd version below 25. The +unchanged service files will not wirk correctly. + +udev 167 +======== +Bugfixes. + +The udev runtime data moved from /dev/.udev/ to /run/udev/. The +/run mountpoint is supposed to be a tmpfs mounted during early boot, +available and writable to for all tools at any time during bootup, +it replaces /var/run/, which should become a symlink some day. + +If /run does not exist, or is not writable, udev will fall back using +/dev/.udev/. + +On systemd systems with initramfs and LVM used, packagers must +make sure, that the systemd and initramfs versions match. The initramfs +needs to create the /run mountpoint for udev to store the data, and +mount this tmpfs to /run in the rootfs, so the that the udev database +is preserved for the udev version started in the rootfs. + +The command 'udevadm info --convert-db' is gone. The udev daemon +itself, at startup, converts any old database version if necessary. + +The systemd services files have been reorganized. The udev control +socket is bound by systemd and passed to the started udev daemon. +The udev-settle.service is no longer active by default. Services which +can not handle hotplug setups properly need to actively pull it in, to +act like a barrier. Alternatively the settle service can be unconditionally +'systemctl'enabled, and act like a barrier for basic.target. + +The fstab_import callout is no longer built or installed. Udev +should not be used to mount, does not watch changes to fstab, and +should not mirror fstab values in the udev database. + udev 166 ======== Bugfixes. diff --git a/README b/README index 7878746..5a8d4cc 100644 --- a/README +++ b/README @@ -3,21 +3,26 @@ udev - Linux userspace device management Integrating udev in the system has complex dependencies and may differ from distribution to distribution. A system may not be able to boot up or work reliably without a properly installed udev version. The upstream udev project -does not recommend to replace a distro's udev installation with the upstream +does not recommend replacing a distro's udev installation with the upstream version. The upstream udev project's set of default rules may require a most recent -kernel release to work properly. This is currently version 2.6.31. +kernel release to work properly. This is currently version 2.6.32. Tools and rules shipped by udev are not public API and may change at any time. -Never call any private tool in /lib/udev from any external application, it might +Never call any private tool in /lib/udev from any external application; it might just go away in the next release. Access to udev information is only offered -by udevadm and libudev. Tools and rules in /lib/udev, and the entire content of -the /dev/.udev directory is private to udev and does change whenever needed. +by udevadm and libudev. Tools and rules in /lib/udev and the entire contents of +the /run/udev directory are private to udev and do change whenever needed. Requirements: - - Version 2.6.27 of the Linux kernel with sysfs, procfs, signalfd, inotify, - unix domain sockets, networking and hotplug enabled: + - Version 2.6.34 of the Linux kernel with sysfs, procfs, signalfd, inotify, + unix domain sockets, networking and hotplug enabled + + - Some architectures might need a later kernel, that supports accept4(), + or need to backport the accept4() syscall wiring in the kernel. + + - These options are needed: CONFIG_HOTPLUG=y CONFIG_UEVENT_HELPER_PATH="" CONFIG_NET=y @@ -25,13 +30,15 @@ Requirements: CONFIG_SYSFS=y CONFIG_SYSFS_DEPRECATED*=n CONFIG_PROC_FS=y - CONFIG_TMPFS=y CONFIG_INOTIFY_USER=y CONFIG_SIGNALFD=y + + - These options might be needed: + CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y (user ACLs for device nodes) CONFIG_BLK_DEV_BSG=y (SCSI devices) - - Udev will not work with the CONFIG_SYSFS_DEPRECATED* option. + - Udev does not work with the CONFIG_SYSFS_DEPRECATED* option. - Unix domain sockets (CONFIG_UNIX) as a loadable kernel module may work, but it is not supported. @@ -41,47 +48,47 @@ Requirements: unusable because the kernel may create too many processes in parallel so that the system runs out-of-memory. - - The proc filesystem must be mounted on /proc, the sysfs filesystem must + - The proc filesystem must be mounted on /proc, and the sysfs filesystem must be mounted at /sys. No other locations are supported by a standard udev installation. - - The system must have the following group names resolvable at udev startup: - disk, cdrom, floppy, tape, audio, video, lp, tty, dialout, kmem. - Especially in LDAP setups, it is required, that getgrnam() is able to resolve - these group names with only the rootfs mounted, and while no network is + - The default rule sset requires the following group names resolvable at udev startup: + disk, cdrom, floppy, tape, audio, video, lp, tty, dialout, and kmem. + Especially in LDAP setups, it is required that getgrnam() be able to resolve + these group names with only the rootfs mounted and while no network is available. - - To build all 'udev extras', libacl, libglib2, libusb, usbutils, pciutils, - gperf are needed. These dependencies can be disabled with the - --disable-extras configure option. + - Some udev extras have external dependencies like: + libacl, libglib2, usbutils, pciutils, and gperf. + All these extras can be disabled with configure options. Setup: - At bootup, the /dev directory should get the 'devtmpfs' filesystem - mounted. Udev will manage permissions and ownership of the kernel-created - device nodes, and possibly create additional symlinks. If needed, udev also - works on an empty 'tmpfs' filesystem, but some static device nodes like - /dev/null, /dev/console, /dev/kmsg are needed to be able to start udev itself. + mounted. Udev manages the permissions and ownership of the kernel-created + device nodes, and udev possibly creates additional symlinks. If needed, udev also + works on an empty 'tmpfs' filesystem, but some device nodes like + /dev/null, /dev/console, /dev/kmsg should be created before udevd is started. - The udev daemon should be started to handle device events sent by the kernel. - During bootup, the kernel can be asked to send events for all already existing - devices, to apply the configuration to these devices. This is usually done by: - /sbin/udevadm trigger --type=subsystems - /sbin/udevadm trigger --type=devices + During bootup, the events for already existing devices can be replayed, so + that they are configured by udev. This is usually done by: + /sbin/udevadm trigger --action=add --type=subsystems + /sbin/udevadm trigger --action=add --type=devices - - Restarting the daemon does never apply any rules to existing devices. + - Restarting the daemon never applies any rules to existing devices. - - New/changed rule files are picked up automatically, there is no daemon + - New/changed rule files are picked up automatically; there is no daemon restart or signal needed. Operation: - - Udev creates/removes device nodes in /dev, based on events the kernel - sends out on device creation/removal. + - Based on events the kernel sends out on device creation/removal, udev + creates/removes device nodes and symlinks in the /dev directory. - All kernel events are matched against a set of specified rules, which possibly hook into the event processing and load required kernel - modules to setup devices. For all devices the kernel exports a major/minor - number, if needed, udev will create a device node with the default kernel - name. If specified, udev applies permissions/ownership to the device + modules to set up devices. For all devices, the kernel exports a major/minor + number; if needed, udev creates a device node with the default kernel + device name. If specified, udev applies permissions/ownership to the device node, creates additional symlinks pointing to the node, and executes programs to handle the device. @@ -90,7 +97,8 @@ Operation: http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/ http://www.kernel.org/pub/linux/utils/kernel/hotplug/gudev/ -For more details about udev and udev rules see the udev(7) man page. +For more details about udev and udev rules, see the udev man pages: + http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/ Please direct any comment/question to the linux-hotplug mailing list at: linux-hotplug@vger.kernel.org diff --git a/TODO b/TODO index 029b70e..96d5b68 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,18 @@ + - test (now fixed) /dev/tape/ links + + - move udevadm -> --bindir + + - have a $attrs{} ? + + - kill rules_generator + + - kill tabs? + + - deprecate and warn about RUN+="socket:" + + - libudev.so.1 + - symbol versioning + - return object with *_unref() + - udev_monitor_from_socket() + - udev_queue_get_failed_list_entry() - o get rid of "scan all devices to find myself" libusb interface - if it can not be fixed, drop libusb entirely and add a simple - wrapper around the Linux usb ioctls we need - o remove deprecated BUS=, SYSFS{}=, ID= keys diff --git a/aclocal.m4 b/aclocal.m4 index 27f994d..107ba72 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -156,7 +156,7 @@ $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -_PKG_TEXT])[]dnl +_PKG_TEXT]) ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) @@ -167,7 +167,7 @@ path to pkg-config. _PKG_TEXT -To get pkg-config, see .])[]dnl +To get pkg-config, see .]) ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS @@ -899,6 +899,23 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 diff --git a/autogen.sh b/autogen.sh index d35e945..f659fca 100755 --- a/autogen.sh +++ b/autogen.sh @@ -8,7 +8,7 @@ MYCFLAGS="-g -Wall \ -Wnested-externs -Wpointer-arith \ -Wpointer-arith -Wsign-compare -Wchar-subscripts \ -Wstrict-prototypes -Wshadow \ --Wformat=2 -Wtype-limits" +-Wformat-security -Wtype-limits" case "$CFLAGS" in *-O[0-9]*) diff --git a/config.guess b/build-aux/config.guess similarity index 92% rename from config.guess rename to build-aux/config.guess index 666c5ad..dc84c68 100755 --- a/config.guess +++ b/build-aux/config.guess @@ -139,16 +139,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_MACHINE}" in - i?86) - test -z "$VENDOR" && VENDOR=pc - ;; - *) - test -z "$VENDOR" && VENDOR=unknown - ;; -esac -test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -213,19 +203,19 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-${VENDOR}-openbsd${UNAME_RELEASE} + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-ekkobsd${UNAME_RELEASE} + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-solidbsd${UNAME_RELEASE} + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) - echo powerpc-${VENDOR}-mirbsd${UNAME_RELEASE} + echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-mirbsd${UNAME_RELEASE} + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in @@ -290,13 +280,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-${VENDOR}-sysv4 + echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-amigaos + echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-morphos + echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition @@ -311,7 +301,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-${VENDOR}-riscos + echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp @@ -419,7 +409,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-${VENDOR}-mint${UNAME_RELEASE} + echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} @@ -730,9 +720,9 @@ EOF exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-${VENDOR}-osf1mk + echo ${UNAME_MACHINE}-unknown-osf1mk else - echo ${UNAME_MACHINE}-${VENDOR}-osf1 + echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) @@ -792,19 +782,19 @@ EOF echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) - echo sparc-${VENDOR}-bsdi${UNAME_RELEASE} + echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-bsdi${UNAME_RELEASE} + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) - echo i386-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) - echo x86_64-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) - echo ${UNAME_MACHINE}-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) @@ -826,10 +816,10 @@ EOF echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) - echo x86_64-${VENDOR}-interix${UNAME_RELEASE} + echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) - echo ia64-${VENDOR}-interix${UNAME_RELEASE} + echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) @@ -848,21 +838,21 @@ EOF echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-${VENDOR}-cygwin + echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) - echo powerpcle-${VENDOR}-cygwin + echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) - echo powerpcle-${VENDOR}-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-${VENDOR}-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-${VENDOR}-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix @@ -879,20 +869,20 @@ EOF esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu else - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnueabi + echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu @@ -901,7 +891,7 @@ EOF echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) - echo frv-${VENDOR}-linux-gnu + echo frv-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu @@ -912,16 +902,16 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -940,51 +930,51 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-gnu"; exit; } + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) - echo or32-${VENDOR}-linux-gnu + echo or32-unknown-linux-gnu exit ;; padre:Linux:*:*) - echo sparc-${VENDOR}-linux-gnu + echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-${VENDOR}-linux-gnu + echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-${VENDOR}-linux-gnu ;; - PA8*) echo hppa2.0-${VENDOR}-linux-gnu ;; - *) echo hppa-${VENDOR}-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-${VENDOR}-linux-gnu + echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) - echo powerpc-${VENDOR}-linux-gnu + echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) - echo x86_64-${VENDOR}-linux-gnu + echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1006,16 +996,16 @@ EOF echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-${VENDOR}-stop + echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-atheos + echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-${VENDOR}-lynxos${UNAME_RELEASE} + echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp @@ -1035,7 +1025,7 @@ EOF *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo ${UNAME_MACHINE}-${VENDOR}-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then @@ -1074,7 +1064,7 @@ EOF if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-${VENDOR}-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) @@ -1111,19 +1101,19 @@ EOF /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-${VENDOR}-lynxos${UNAME_RELEASE} + echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-${VENDOR}-lynxos${UNAME_RELEASE} + echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) - echo rs6000-${VENDOR}-lynxos${UNAME_RELEASE} + echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-${VENDOR}-lynxos${UNAME_RELEASE} + echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} @@ -1173,7 +1163,7 @@ EOF if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-${VENDOR}-sysv${UNAME_RELEASE} + echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. @@ -1264,13 +1254,13 @@ EOF else UNAME_MACHINE="$cputype" fi - echo ${UNAME_MACHINE}-${VENDOR}-plan9 + echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) - echo pdp10-${VENDOR}-tops10 + echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) - echo pdp10-${VENDOR}-tenex + echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 @@ -1279,16 +1269,16 @@ EOF echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) - echo pdp10-${VENDOR}-tops20 + echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) - echo pdp10-${VENDOR}-its + echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` diff --git a/config.sub b/build-aux/config.sub similarity index 100% rename from config.sub rename to build-aux/config.sub diff --git a/depcomp b/build-aux/depcomp similarity index 100% rename from depcomp rename to build-aux/depcomp diff --git a/install-sh b/build-aux/install-sh similarity index 100% rename from install-sh rename to build-aux/install-sh diff --git a/ltmain.sh b/build-aux/ltmain.sh similarity index 68% rename from ltmain.sh rename to build-aux/ltmain.sh index a72f2fd..aa5624c 100755 --- a/ltmain.sh +++ b/build-aux/ltmain.sh @@ -1,9 +1,9 @@ -# Generated from ltmain.m4sh. -# ltmain.sh (GNU libtool) 2.2.6b +# libtool (GNU libtool) 2.4 # Written by Gordon Matzigkeit , 1996 -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -32,50 +32,56 @@ # # Provide generalized library-building support services. # -# --config show all configuration variables -# --debug enable verbose shell tracing -# -n, --dry-run display commands without modifying any files -# --features display basic configuration information and exit -# --mode=MODE use operation mode MODE -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print informational messages (default) -# --version print version information -# -h, --help print short or long help message +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --no-quiet, --no-silent +# print informational messages (default) +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print more informational messages than default +# --no-verbose don't print the extra informational messages +# --version print version information +# -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # -# clean remove files from the build directory -# compile compile a source file into a libtool object -# execute automatically set library path, then run a program -# finish complete the installation of libtool libraries -# install install libraries or executables -# link create a library or an executable -# uninstall remove libraries from an installed directory +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory # -# MODE-ARGS vary depending on the MODE. +# MODE-ARGS vary depending on the MODE. When passed as first option, +# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.2.6b -# automake: $automake_version -# autoconf: $autoconf_version +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.4 +# automake: $automake_version +# autoconf: $autoconf_version # # Report bugs to . +# GNU libtool home page: . +# General help using GNU software: . -PROGRAM=ltmain.sh +PROGRAM=libtool PACKAGE=libtool -VERSION=2.2.6b +VERSION=2.4 TIMESTAMP="" -package_revision=1.3017 +package_revision=1.3293 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then @@ -91,10 +97,15 @@ fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + # NLS nuisances: We save the old values to restore during execute mode. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES @@ -107,15 +118,24 @@ do lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL $lt_unset CDPATH +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" : ${CP="cp -f"} -: ${ECHO="echo"} +test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${EGREP="/bin/grep -E"} : ${FGREP="/bin/grep -F"} : ${GREP="/bin/grep"} @@ -144,6 +164,27 @@ IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} # func_dirname may be replaced by extended shell implementation + + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "${1}" | $SED "$basename"` +} # func_basename may be replaced by extended shell implementation + + # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: @@ -158,33 +199,183 @@ basename="s,^.*/,," # those functions but instead duplicate the functionality here. func_dirname_and_basename () { - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` +} # func_dirname_and_basename may be replaced by extended shell implementation + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname may be replaced by extended shell implementation + + +# These SED scripts presuppose an absolute path with a trailing slash. +pathcar='s,^/\([^/]*\).*$,\1,' +pathcdr='s,^/[^/]*,,' +removedotparts=':dotsl + s@/\./@/@g + t dotsl + s,/\.$,/,' +collapseslashes='s@/\{1,\}@/@g' +finalslash='s,/*$,/,' + +# func_normal_abspath PATH +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +# value returned in "$func_normal_abspath_result" +func_normal_abspath () +{ + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` + while :; do + # Processed it all yet? + if test "$func_normal_abspath_tpath" = / ; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result" ; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } -# Generated shell functions inserted here. +# func_relative_path SRCDIR DSTDIR +# generates a relative path from SRCDIR to DSTDIR, with a trailing +# slash if non-empty, suitable for immediately appending a filename +# without needing to append a separator. +# value returned in "$func_relative_path_result" +func_relative_path () +{ + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=${func_dirname_result} + if test "x$func_relative_path_tlibdir" = x ; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test "x$func_stripname_result" != x ; then + func_relative_path_result=${func_relative_path_result}/${func_stripname_result} + fi + + # Normalisation. If bindir is libdir, return empty string, + # else relative path ending with a slash; either way, target + # file name can be directly appended. + if test ! -z "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result/" + func_relative_path_result=$func_stripname_result + fi +} # The name of this program: -# In the unlikely event $progname began with a '-', it would play havoc with -# func_echo (imagine progname=-n), so we prepend ./ in that case: func_dirname_and_basename "$progpath" progname=$func_basename_result -case $progname in - -*) progname=./$progname ;; -esac # Make sure we have an absolute path for reexecution: case $progpath in @@ -215,6 +406,15 @@ sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' + +# Sed substitution that converts a w32 file name or path +# which contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. @@ -243,7 +443,7 @@ opt_warning=: # name if it has been set yet. func_echo () { - $ECHO "$progname${mode+: }$mode: $*" + $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... @@ -258,18 +458,25 @@ func_verbose () : } +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + # func_error arg... # Echo program name prefixed message to standard error. func_error () { - $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 + $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { - $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 + $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : @@ -326,9 +533,9 @@ func_mkdir_p () case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` + my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done - my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` + my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do @@ -378,7 +585,7 @@ func_mktempdir () func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi - $ECHO "X$my_tmpdir" | $Xsed + $ECHO "$my_tmpdir" } @@ -392,7 +599,7 @@ func_quote_for_eval () { case $1 in *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; + func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac @@ -419,7 +626,7 @@ func_quote_for_expand () { case $1 in *[\\\`\"]*) - my_arg=`$ECHO "X$1" | $Xsed \ + my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; @@ -488,15 +695,39 @@ func_show_eval_locale () fi } - - +# func_tr_sh +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} # func_version # Echo version message to standard output and exit. func_version () { - $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { + $opt_debug + + $SED -n '/(C)/!b go + :more + /\./!{ + N + s/\n# / / + b more + } + :go + /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ @@ -509,22 +740,28 @@ func_version () # Echo short help message to standard output and exit. func_usage () { - $SED -n '/^# Usage:/,/# -h/ { + $opt_debug + + $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" - $ECHO + echo $ECHO "run \`$progname --help | more' for full usage" exit $? } -# func_help -# Echo long help message to standard output and exit. +# func_help [NOEXIT] +# Echo long help message to standard output and exit, +# unless 'noexit' is passed as argument. func_help () { + $opt_debug + $SED -n '/^# Usage:/,/# Report bugs to/ { + :print s/^# // s/^# *$// s*\$progname*'$progname'* @@ -537,8 +774,15 @@ func_help () s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ p - }' < "$progpath" - exit $? + d + } + /^# .* home page:/b print + /^# General help using/b print + ' < "$progpath" + ret=$? + if test -z "$1"; then + exit $ret + fi } # func_missing_arg argname @@ -546,63 +790,106 @@ func_help () # exit_cmd. func_missing_arg () { - func_error "missing argument for $1" + $opt_debug + + func_error "missing argument for $1." exit_cmd=exit } -exit_cmd=: +# func_split_short_opt shortopt +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +func_split_short_opt () +{ + my_sed_short_opt='1s/^\(..\).*$/\1/;q' + my_sed_short_rest='1s/^..\(.*\)$/\1/;q' + func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` + func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` +} # func_split_short_opt may be replaced by extended shell implementation + + +# func_split_long_opt longopt +# Set func_split_long_opt_name and func_split_long_opt_arg shell +# variables after splitting LONGOPT at the `=' sign. +func_split_long_opt () +{ + my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' + my_sed_long_arg='1s/^--[^=]*=//' + + func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` + func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` +} # func_split_long_opt may be replaced by extended shell implementation + +exit_cmd=: -# Check that we have a working $ECHO. -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell, and then maybe $ECHO will work. - exec $SHELL "$progpath" --no-reexec ${1+"$@"} -fi -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null || echo $max_cmd_len` +} # func_len may be replaced by extended shell implementation + + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` +} # func_lo2o may be replaced by extended shell implementation + + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` +} # func_xform may be replaced by extended shell implementation + + # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. @@ -636,16 +923,16 @@ func_config () # Display the features supported by this script. func_features () { - $ECHO "host: $host" + echo "host: $host" if test "$build_libtool_libs" = yes; then - $ECHO "enable shared libraries" + echo "enable shared libraries" else - $ECHO "disable shared libraries" + echo "disable shared libraries" fi if test "$build_old_libs" = yes; then - $ECHO "enable static libraries" + echo "enable static libraries" else - $ECHO "disable static libraries" + echo "disable static libraries" fi exit $? @@ -692,117 +979,204 @@ func_enable_tag () esac } -# Parse options once, thoroughly. This comes as soon as possible in -# the script to make things like `libtool --version' happen quickly. +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () { + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi - # Shorthand for --mode=foo, only valid as the first argument - case $1 in - clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; - compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; - execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; - finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; - install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; - link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; - uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; - esac + exit $EXIT_MISMATCH + fi +} + + +# Shorthand for --mode=foo, only valid as the first argument +case $1 in +clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; +compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; +execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; +finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; +install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; +link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; +uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; +esac + + + +# Option defaults: +opt_debug=: +opt_dry_run=false +opt_config=false +opt_preserve_dup_deps=false +opt_features=false +opt_finish=false +opt_help=false +opt_help_all=false +opt_silent=: +opt_verbose=: +opt_silent=false +opt_verbose=false - # Parse non-mode specific arguments: - while test "$#" -gt 0; do + +# Parse options once, thoroughly. This comes as soon as possible in the +# script to make things like `--version' happen as quickly as we can. +{ + # this just eases exit handling + while test $# -gt 0; do opt="$1" shift - case $opt in - --config) func_config ;; - - --debug) preserve_args="$preserve_args $opt" + --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" - opt_debug='set -x' $opt_debug ;; - - -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break - execute_dlfiles="$execute_dlfiles $1" - shift + --dry-run|--dryrun|-n) + opt_dry_run=: ;; - - --dry-run | -n) opt_dry_run=: ;; - --features) func_features ;; - --finish) mode="finish" ;; - - --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break - case $1 in - # Valid mode arguments: - clean) ;; - compile) ;; - execute) ;; - finish) ;; - install) ;; - link) ;; - relink) ;; - uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; - esac - - mode="$1" + --config) + opt_config=: +func_config + ;; + --dlopen|-dlopen) + optarg="$1" + opt_dlopen="${opt_dlopen+$opt_dlopen +}$optarg" shift ;; - --preserve-dup-deps) - opt_duplicate_deps=: ;; - - --quiet|--silent) preserve_args="$preserve_args $opt" - opt_silent=: + opt_preserve_dup_deps=: ;; - - --verbose| -v) preserve_args="$preserve_args $opt" + --features) + opt_features=: +func_features + ;; + --finish) + opt_finish=: +set dummy --mode finish ${1+"$@"}; shift + ;; + --help) + opt_help=: + ;; + --help-all) + opt_help_all=: +opt_help=': help-all' + ;; + --mode) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_mode="$optarg" +case $optarg in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; +esac + shift + ;; + --no-silent|--no-quiet) opt_silent=false +func_append preserve_args " $opt" ;; - - --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break - preserve_args="$preserve_args $opt $1" - func_enable_tag "$1" # tagname is set here + --no-verbose) + opt_verbose=false +func_append preserve_args " $opt" + ;; + --silent|--quiet) + opt_silent=: +func_append preserve_args " $opt" + opt_verbose=false + ;; + --verbose|-v) + opt_verbose=: +func_append preserve_args " $opt" +opt_silent=false + ;; + --tag) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_tag="$optarg" +func_append preserve_args " $opt $optarg" +func_enable_tag "$optarg" shift ;; + -\?|-h) func_usage ;; + --help) func_help ;; + --version) func_version ;; + # Separate optargs to long options: - -dlopen=*|--mode=*|--tag=*) - func_opt_split "$opt" - set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} + --*=*) + func_split_long_opt "$opt" + set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; - -\?|-h) func_usage ;; - --help) opt_help=: ;; - --version) func_version ;; - - -*) func_fatal_help "unrecognized option \`$opt'" ;; - - *) nonopt="$opt" - break + # Separate non-argument short options: + -\?*|-h*|-n*|-v*) + func_split_short_opt "$opt" + set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} + shift ;; + + --) break ;; + -*) func_fatal_help "unrecognized option \`$opt'" ;; + *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done + # Validate options: + + # save first non-option argument + if test "$#" -gt 0; then + nonopt="$opt" + shift + fi + + # preserve --debug + test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) @@ -810,82 +1184,44 @@ func_enable_tag () opt_duplicate_compiler_generated_deps=: ;; *) - opt_duplicate_compiler_generated_deps=$opt_duplicate_deps + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac - # Having warned about all mis-specified options, bail out if - # anything was wrong. - $exit_cmd $EXIT_FAILURE -} + $opt_help || { + # Sanity checks first: + func_check_version_match -# func_check_version_match -# Ensure that we are using m4 macros, and libtool script from the same -# release of libtool. -func_check_version_match () -{ - if test "$package_revision" != "$macro_revision"; then - if test "$VERSION" != "$macro_version"; then - if test -z "$macro_version"; then - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from an older release. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - fi - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, -$progname: but the definition of this LT_INIT comes from revision $macro_revision. -$progname: You should recreate aclocal.m4 with macros from revision $package_revision -$progname: of $PACKAGE $VERSION and run autoconf again. -_LT_EOF + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" fi - exit $EXIT_MISMATCH - fi -} - - -## ----------- ## -## Main. ## -## ----------- ## - -$opt_help || { - # Sanity checks first: - func_check_version_match + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" - if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - func_fatal_configuration "not configured to build any kind of library" - fi + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test "$opt_mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi - test -z "$mode" && func_fatal_error "error: you must specify a MODE." + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$opt_mode' for more information." + } - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" + # Bail if the options were screwed + $exit_cmd $EXIT_FAILURE +} - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE - fi - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$progname --help --mode=$mode' for more information." -} +## ----------- ## +## Main. ## +## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. @@ -950,12 +1286,9 @@ func_ltwrapper_executable_p () # temporary ltwrapper_script. func_ltwrapper_scriptname () { - func_ltwrapper_scriptname_result="" - if func_ltwrapper_executable_p "$1"; then - func_dirname_and_basename "$1" "" "." - func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" - fi + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file @@ -1001,6 +1334,37 @@ func_source () } +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case "$lt_sysroot:$1" in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result="=$func_stripname_result" + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. @@ -1013,13 +1377,15 @@ func_infer_tag () if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do - func_quote_for_eval "$arg" - CC_quoted="$CC_quoted $func_quote_for_eval_result" + func_append_quoted CC_quoted "$arg" done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) @@ -1030,11 +1396,13 @@ func_infer_tag () CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. - func_quote_for_eval "$arg" - CC_quoted="$CC_quoted $func_quote_for_eval_result" + func_append_quoted CC_quoted "$arg" done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in - " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. @@ -1097,6 +1465,486 @@ EOF } } + +################################################## +# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # +################################################## + +# func_convert_core_file_wine_to_w32 ARG +# Helper function used by file name conversion functions when $build is *nix, +# and $host is mingw, cygwin, or some other w32 environment. Relies on a +# correctly configured wine environment available, with the winepath program +# in $build's $PATH. +# +# ARG is the $build file name to be converted to w32 format. +# Result is available in $func_convert_core_file_wine_to_w32_result, and will +# be empty on error (or when ARG is empty) +func_convert_core_file_wine_to_w32 () +{ + $opt_debug + func_convert_core_file_wine_to_w32_result="$1" + if test -n "$1"; then + # Unfortunately, winepath does not exit with a non-zero error code, so we + # are forced to check the contents of stdout. On the other hand, if the + # command is not found, the shell will set an exit code of 127 and print + # *an error message* to stdout. So we must check for both error code of + # zero AND non-empty stdout, which explains the odd construction: + func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` + if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$lt_sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $opt_debug + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result="" + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result" ; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $opt_debug + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $opt_debug + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $opt_debug + if test -z "$2" && test -n "$1" ; then + func_error "Could not determine host file name corresponding to" + func_error " \`$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result="$1" + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $opt_debug + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " \`$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result="$3" + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $opt_debug + case $4 in + $1 ) func_to_host_path_result="$3$func_to_host_path_result" + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via `$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $opt_debug + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $opt_debug + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result="$1" +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result="$func_convert_core_msys_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via `$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $opt_debug + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd="func_convert_path_${func_stripname_result}" + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $opt_debug + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result="$1" +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_msys_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + # func_mode_compile arg... func_mode_compile () { @@ -1137,12 +1985,12 @@ func_mode_compile () ;; -pie | -fpie | -fPIE) - pie_flag="$pie_flag $arg" + func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) - later="$later $arg" + func_append later " $arg" continue ;; @@ -1163,15 +2011,14 @@ func_mode_compile () save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" - func_quote_for_eval "$arg" - lastarg="$lastarg $func_quote_for_eval_result" + func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. - base_compile="$base_compile $lastarg" + func_append base_compile " $lastarg" continue ;; @@ -1187,8 +2034,7 @@ func_mode_compile () esac # case $arg_mode # Aesthetically quote the previous argument. - func_quote_for_eval "$lastarg" - base_compile="$base_compile $func_quote_for_eval_result" + func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in @@ -1213,7 +2059,7 @@ func_mode_compile () *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ - *.[fF][09]? | *.for | *.java | *.obj | *.sx) + *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; @@ -1288,7 +2134,7 @@ func_mode_compile () # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then - output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= @@ -1319,17 +2165,16 @@ compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi - removelist="$removelist $output_obj" + func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist - removelist="$removelist $lockfile" + func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result @@ -1349,7 +2194,7 @@ compiler." if test -z "$output_obj"; then # Place PIC objects in $objdir - command="$command -o $lobj" + func_append command " -o $lobj" fi func_show_eval_locale "$command" \ @@ -1396,11 +2241,11 @@ compiler." command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then - command="$command -o $obj" + func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. - command="$command$suppress_output" + func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' @@ -1445,13 +2290,13 @@ compiler." } $opt_help || { -test "$mode" = compile && func_mode_compile ${1+"$@"} + test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. - case $mode in + case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. @@ -1482,10 +2327,11 @@ This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes - -prefer-pic try to building PIC objects only - -prefer-non-pic try to building non-PIC objects only + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking + -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. @@ -1538,7 +2384,7 @@ either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: - -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." @@ -1558,6 +2404,8 @@ The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) @@ -1586,6 +2434,11 @@ The following components of LINK-COMMAND are treated specially: -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. @@ -1619,18 +2472,44 @@ Otherwise, only FILE itself is deleted using RM." ;; *) - func_fatal_help "invalid operation mode \`$mode'" + func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac - $ECHO + echo $ECHO "Try \`$progname --help' for more information about other modes." - - exit $? } - # Now that we've collected a possible --mode arg, show help if necessary - $opt_help && func_mode_help +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test "$opt_help" = :; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | sed -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + sed '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi # func_mode_execute arg... @@ -1643,13 +2522,16 @@ func_mode_execute () func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do + for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" @@ -1671,7 +2553,7 @@ func_mode_execute () dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" + func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" @@ -1712,7 +2594,7 @@ func_mode_execute () for file do case $file in - -*) ;; + -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then @@ -1728,8 +2610,7 @@ func_mode_execute () ;; esac # Quote arguments (to preserve shell metacharacters). - func_quote_for_eval "$file" - args="$args $func_quote_for_eval_result" + func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then @@ -1754,29 +2635,66 @@ func_mode_execute () # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" - $ECHO "export $shlibpath_var" + echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } -test "$mode" = execute && func_mode_execute ${1+"$@"} +test "$opt_mode" = execute && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $opt_debug + libs= + libdirs= + admincmds= + + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "\`$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument \`$opt'" + fi + done + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi -# func_mode_finish arg... -func_mode_finish () -{ - $opt_debug - libdirs="$nonopt" - admincmds= + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and \`=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. @@ -1786,7 +2704,7 @@ func_mode_finish () if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" - $opt_dry_run || eval "$cmds" || admincmds="$admincmds + $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done @@ -1795,53 +2713,55 @@ func_mode_finish () # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS - $ECHO "X----------------------------------------------------------------------" | $Xsed - $ECHO "Libraries have been installed in:" - for libdir in $libdirs; do - $ECHO " $libdir" - done - $ECHO - $ECHO "If you ever happen to want to link against installed libraries" - $ECHO "in a given directory, LIBDIR, you must either use libtool, and" - $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" - $ECHO "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" - $ECHO " during execution" - fi - if test -n "$runpath_var"; then - $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" - $ECHO " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" - $ECHO " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $ECHO " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - $ECHO + $ECHO " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo - $ECHO "See any operating system documentation about shared libraries for" - case $host in - solaris2.[6789]|solaris2.1[0-9]) - $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" - $ECHO "pages." - ;; - *) - $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." - ;; - esac - $ECHO "X----------------------------------------------------------------------" | $Xsed + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi exit $EXIT_SUCCESS } -test "$mode" = finish && func_mode_finish ${1+"$@"} +test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... @@ -1852,7 +2772,7 @@ func_mode_install () # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. - $ECHO "X$nonopt" | $GREP shtool >/dev/null; then + case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " @@ -1866,7 +2786,12 @@ func_mode_install () # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" - install_prog="$install_prog$func_quote_for_eval_result" + func_append install_prog "$func_quote_for_eval_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac # We need to accept at least all the BSD install flags. dest= @@ -1876,10 +2801,12 @@ func_mode_install () install_type= isdir=no stripme= + no_mode=: for arg do + arg2= if test -n "$dest"; then - files="$files $dest" + func_append files " $dest" dest=$arg continue fi @@ -1887,10 +2814,9 @@ func_mode_install () case $arg in -d) isdir=yes ;; -f) - case " $install_prog " in - *[\\\ /]cp\ *) ;; - *) prev=$arg ;; - esac + if $install_cp; then :; else + prev=$arg + fi ;; -g | -m | -o) prev=$arg @@ -1904,6 +2830,10 @@ func_mode_install () *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then + if test "x$prev" = x-m && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi prev= else dest=$arg @@ -1914,7 +2844,11 @@ func_mode_install () # Aesthetically quote the argument. func_quote_for_eval "$arg" - install_prog="$install_prog $func_quote_for_eval_result" + func_append install_prog " $func_quote_for_eval_result" + if test -n "$arg2"; then + func_quote_for_eval "$arg2" + fi + func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ @@ -1923,6 +2857,13 @@ func_mode_install () test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" + fi + fi + if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" @@ -1977,10 +2918,13 @@ func_mode_install () case $file in *.$libext) # Do the static libraries later. - staticlibs="$staticlibs $file" + func_append staticlibs " $file" ;; *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" @@ -1994,23 +2938,23 @@ func_mode_install () if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; + *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; + *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" - dir="$dir$objdir" + func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that @@ -2023,9 +2967,9 @@ func_mode_install () if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. - relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else - relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" @@ -2043,7 +2987,7 @@ func_mode_install () test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. - func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in @@ -2083,7 +3027,7 @@ func_mode_install () func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) @@ -2183,7 +3127,7 @@ func_mode_install () if test -f "$lib"; then func_source "$lib" fi - libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no @@ -2202,7 +3146,7 @@ func_mode_install () file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. - relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" @@ -2221,7 +3165,7 @@ func_mode_install () } else # Install the binary that we compiled earlier. - file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi @@ -2280,7 +3224,7 @@ func_mode_install () fi } -test "$mode" = install && func_mode_install ${1+"$@"} +test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p @@ -2323,6 +3267,22 @@ func_generate_dlsyms () extern \"C\" { #endif +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + /* External symbol declarations for the compiler. */\ " @@ -2332,10 +3292,11 @@ extern \"C\" { $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. - progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do - func_verbose "extracting global C symbols from \`$progfile'" - $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then @@ -2371,7 +3332,7 @@ extern \"C\" { eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in - *cygwin | *mingw* | *cegcc* ) + *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; @@ -2384,10 +3345,52 @@ extern \"C\" { func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename="" + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname" ; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename="$func_basename_result" + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename" ; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac done $opt_dry_run || { @@ -2415,36 +3418,19 @@ extern \"C\" { if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else - $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi - $ECHO >> "$output_objdir/$my_dlsyms" "\ + echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; -" - case $host in - *cygwin* | *mingw* | *cegcc* ) - $ECHO >> "$output_objdir/$my_dlsyms" "\ -/* DATA imports from DLLs on WIN32 con't be const, because - runtime relocations are performed -- see ld's documentation - on pseudo-relocs. */" - lt_dlsym_const= ;; - *osf5*) - echo >> "$output_objdir/$my_dlsyms" "\ -/* This system does not cope well with relocations in const data */" - lt_dlsym_const= ;; - *) - lt_dlsym_const=const ;; - esac - - $ECHO >> "$output_objdir/$my_dlsyms" "\ -extern $lt_dlsym_const lt_dlsymlist +extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; -$lt_dlsym_const lt_dlsymlist +LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," @@ -2457,7 +3443,7 @@ lt_${my_prefix}_LTX_preloaded_symbols[] = eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac - $ECHO >> "$output_objdir/$my_dlsyms" "\ + echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; @@ -2500,7 +3486,7 @@ static const void *lt_preloaded_setup() { for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; - *) symtab_cflags="$symtab_cflags $arg" ;; + *) func_append symtab_cflags " $arg" ;; esac done @@ -2515,16 +3501,16 @@ static const void *lt_preloaded_setup() { case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; @@ -2538,8 +3524,8 @@ static const void *lt_preloaded_setup() { # really was required. # Nullify the symbol file. - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } @@ -2549,6 +3535,7 @@ static const void *lt_preloaded_setup() { # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug @@ -2559,9 +3546,11 @@ func_win32_libid () win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | - $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ @@ -2590,6 +3579,131 @@ func_win32_libid () $ECHO "$win32_libid_type" } +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $opt_debug + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $opt_debug + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive which possess that section. Heuristic: eliminate + # all those which have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $opt_debug + if func_cygming_gnu_implib_p "$1" ; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1" ; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result="" + fi +} # func_extract_an_archive dir oldlib @@ -2598,7 +3712,18 @@ func_extract_an_archive () $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" - func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' + if test "$lock_old_archive_extraction" = yes; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test "$lock_old_archive_extraction" = yes; then + $opt_dry_run || rm -f "$lockfile" + fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else @@ -2669,7 +3794,7 @@ func_extract_archives () darwin_file= darwin_files= for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ @@ -2684,25 +3809,30 @@ func_extract_archives () func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } - -# func_emit_wrapper_part1 [arg=no] +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. # -# Emit the first part of a libtool wrapper script on stdout. -# For more information, see the description associated with -# func_emit_wrapper(), below. -func_emit_wrapper_part1 () +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () { - func_emit_wrapper_part1_arg1=no - if test -n "$1" ; then - func_emit_wrapper_part1_arg1=$1 - fi + func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL @@ -2718,7 +3848,6 @@ func_emit_wrapper_part1 () # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # Be Bourne compatible @@ -2749,31 +3878,132 @@ if test \"\$libtool_install_magic\" = \"$magic\"; then else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then - ECHO=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$ECHO works! - : - else - # Restart under the correct shell, and then maybe \$ECHO will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ + file=\"\$0\"" + + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=\"$qECHO\" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ which is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options which match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ " - $ECHO "\ + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. - thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do - destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then @@ -2783,30 +4013,13 @@ else esac fi - file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done -" -} -# end: func_emit_wrapper_part1 - -# func_emit_wrapper_part2 [arg=no] -# -# Emit the second part of a libtool wrapper script on stdout. -# For more information, see the description associated with -# func_emit_wrapper(), below. -func_emit_wrapper_part2 () -{ - func_emit_wrapper_part2_arg1=no - if test -n "$1" ; then - func_emit_wrapper_part2_arg1=$1 - fi - - $ECHO "\ # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then @@ -2814,7 +4027,7 @@ func_emit_wrapper_part2 () fi # remove .libs from thisdir case \"\$thisdir\" in - *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi @@ -2869,6 +4082,18 @@ func_emit_wrapper_part2 () if test -f \"\$progdir/\$program\"; then" + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ @@ -2877,253 +4102,28 @@ func_emit_wrapper_part2 () # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $ECHO "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) - $ECHO "\ - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $ECHO "\ - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $ECHO "\ - \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 - exit 1 + func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 - $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } -# end: func_emit_wrapper_part2 - - -# func_emit_wrapper [arg=no] -# -# Emit a libtool wrapper script on stdout. -# Don't directly open a file because we may want to -# incorporate the script contents within a cygwin/mingw -# wrapper executable. Must ONLY be called from within -# func_mode_link because it depends on a number of variables -# set therein. -# -# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR -# variable will take. If 'yes', then the emitted script -# will assume that the directory in which it is stored is -# the $objdir directory. This is a cygwin/mingw-specific -# behavior. -func_emit_wrapper () -{ - func_emit_wrapper_arg1=no - if test -n "$1" ; then - func_emit_wrapper_arg1=$1 - fi - - # split this up so that func_emit_cwrapperexe_src - # can call each part independently. - func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" - func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" -} - - -# func_to_host_path arg -# -# Convert paths to host format when used with build tools. -# Intended for use with "native" mingw (where libtool itself -# is running under the msys shell), or in the following cross- -# build environments: -# $build $host -# mingw (msys) mingw [e.g. native] -# cygwin mingw -# *nix + wine mingw -# where wine is equipped with the `winepath' executable. -# In the native mingw case, the (msys) shell automatically -# converts paths for any non-msys applications it launches, -# but that facility isn't available from inside the cwrapper. -# Similar accommodations are necessary for $host mingw and -# $build cygwin. Calling this function does no harm for other -# $host/$build combinations not listed above. -# -# ARG is the path (on $build) that should be converted to -# the proper representation for $host. The result is stored -# in $func_to_host_path_result. -func_to_host_path () -{ - func_to_host_path_result="$1" - if test -n "$1" ; then - case $host in - *mingw* ) - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - case $build in - *mingw* ) # actually, msys - # awkward: cmd appends spaces to result - lt_sed_strip_trailing_spaces="s/[ ]*\$//" - func_to_host_path_tmp1=`( cmd //c echo "$1" |\ - $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - *cygwin* ) - func_to_host_path_tmp1=`cygpath -w "$1"` - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - * ) - # Unfortunately, winepath does not exit with a non-zero - # error code, so we are forced to check the contents of - # stdout. On the other hand, if the command is not - # found, the shell will set an exit code of 127 and print - # *an error message* to stdout. So we must check for both - # error code of zero AND non-empty stdout, which explains - # the odd construction: - func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` - if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ - $SED -e "$lt_sed_naive_backslashify"` - else - # Allow warning below. - func_to_host_path_result="" - fi - ;; - esac - if test -z "$func_to_host_path_result" ; then - func_error "Could not determine host path corresponding to" - func_error " '$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback: - func_to_host_path_result="$1" - fi - ;; - esac - fi -} -# end: func_to_host_path -# func_to_host_pathlist arg -# -# Convert pathlists to host format when used with build tools. -# See func_to_host_path(), above. This function supports the -# following $build/$host combinations (but does no harm for -# combinations not listed here): -# $build $host -# mingw (msys) mingw [e.g. native] -# cygwin mingw -# *nix + wine mingw -# -# Path separators are also converted from $build format to -# $host format. If ARG begins or ends with a path separator -# character, it is preserved (but converted to $host format) -# on output. -# -# ARG is a pathlist (on $build) that should be converted to -# the proper representation on $host. The result is stored -# in $func_to_host_pathlist_result. -func_to_host_pathlist () -{ - func_to_host_pathlist_result="$1" - if test -n "$1" ; then - case $host in - *mingw* ) - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - # Remove leading and trailing path separator characters from - # ARG. msys behavior is inconsistent here, cygpath turns them - # into '.;' and ';.', and winepath ignores them completely. - func_to_host_pathlist_tmp2="$1" - # Once set for this call, this variable should not be - # reassigned. It is used in tha fallback case. - func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ - $SED -e 's|^:*||' -e 's|:*$||'` - case $build in - *mingw* ) # Actually, msys. - # Awkward: cmd appends spaces to result. - lt_sed_strip_trailing_spaces="s/[ ]*\$//" - func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ - $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - *cygwin* ) - func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - * ) - # unfortunately, winepath doesn't convert pathlists - func_to_host_pathlist_result="" - func_to_host_pathlist_oldIFS=$IFS - IFS=: - for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do - IFS=$func_to_host_pathlist_oldIFS - if test -n "$func_to_host_pathlist_f" ; then - func_to_host_path "$func_to_host_pathlist_f" - if test -n "$func_to_host_path_result" ; then - if test -z "$func_to_host_pathlist_result" ; then - func_to_host_pathlist_result="$func_to_host_path_result" - else - func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" - fi - fi - fi - IFS=: - done - IFS=$func_to_host_pathlist_oldIFS - ;; - esac - if test -z "$func_to_host_pathlist_result" ; then - func_error "Could not determine the host path(s) corresponding to" - func_error " '$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback. This may break if $1 contains DOS-style drive - # specifications. The fix is not to complicate the expression - # below, but for the user to provide a working wine installation - # with winepath so that path translation in the cross-to-mingw - # case works properly. - lt_replace_pathsep_nix_to_dos="s|:|;|g" - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ - $SED -e "$lt_replace_pathsep_nix_to_dos"` - fi - # Now, add the leading and trailing path separators back - case "$1" in - :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" - ;; - esac - case "$1" in - *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" - ;; - esac - ;; - esac - fi -} -# end: func_to_host_pathlist # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout @@ -3141,31 +4141,23 @@ func_emit_cwrapperexe_src () This wrapper executable should never be moved out of the build directory. If it is, it will not operate correctly. - - Currently, it simply execs the wrapper *script* "$SHELL $output", - but could eventually absorb all of the scripts functionality and - exec $objdir/$outputname directly. */ EOF cat <<"EOF" +#ifdef _MSC_VER +# define _CRT_SECURE_NO_DEPRECATE 1 +#endif #include #include #ifdef _MSC_VER # include # include # include -# define setmode _setmode #else # include # include # ifdef __CYGWIN__ # include -# define HAVE_SETENV -# ifdef __STRICT_ANSI__ -char *realpath (const char *, char *); -int putenv (char *); -int setenv (const char *, const char *, int); -# endif # endif #endif #include @@ -3177,6 +4169,44 @@ int setenv (const char *, const char *, int); #include #include +/* declarations of non-ANSI functions */ +#if defined(__MINGW32__) +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined(__CYGWIN__) +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined (other platforms) ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined(_MSC_VER) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +# ifndef _INTPTR_T_DEFINED +# define _INTPTR_T_DEFINED +# define intptr_t int +# endif +#elif defined(__MINGW32__) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined(__CYGWIN__) +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined (other platforms) ... */ +#endif + #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) @@ -3192,14 +4222,7 @@ int setenv (const char *, const char *, int); # define S_IXGRP 0 #endif -#ifdef _MSC_VER -# define S_IXUSR _S_IEXEC -# define stat _stat -# ifndef _INTPTR_T_DEFINED -# define intptr_t int -# endif -#endif - +/* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' @@ -3230,10 +4253,6 @@ int setenv (const char *, const char *, int); # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ -#ifdef __CYGWIN__ -# define FOPEN_WB "wb" -#endif - #ifndef FOPEN_WB # define FOPEN_WB "w" #endif @@ -3246,22 +4265,13 @@ int setenv (const char *, const char *, int); if (stale) { free ((void *) stale); stale = 0; } \ } while (0) -#undef LTWRAPPER_DEBUGPRINTF -#if defined DEBUGWRAPPER -# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args -static void -ltwrapper_debugprintf (const char *fmt, ...) -{ - va_list args; - va_start (args, fmt); - (void) vfprintf (stderr, fmt, args); - va_end (args); -} +#if defined(LT_DEBUGWRAPPER) +static int lt_debug = 1; #else -# define LTWRAPPER_DEBUGPRINTF(args) +static int lt_debug = 0; #endif -const char *program_name = NULL; +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); @@ -3271,41 +4281,27 @@ char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); -void lt_fatal (const char *message, ...); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); -void lt_opt_process_env_set (const char *arg); -void lt_opt_process_env_prepend (const char *arg); -void lt_opt_process_env_append (const char *arg); -int lt_split_name_value (const char *arg, char** name, char** value); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); - -static const char *script_text_part1 = -EOF - - func_emit_wrapper_part1 yes | - $SED -e 's/\([\\"]\)/\\\1/g' \ - -e 's/^/ "/' -e 's/$/\\n"/' - echo ";" - cat <"))); + lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", + nonnull (lt_argv_zero)); for (i = 0; i < newargc; i++) { - LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); + lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", + i, nonnull (newargz[i])); } EOF @@ -3560,11 +4517,14 @@ EOF mingw*) cat <<"EOF" /* execv doesn't actually work on mingw as expected on unix */ + newargz = prepare_spawn (newargz); rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); if (rval == -1) { /* failed to start process */ - LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); + lt_debugprintf (__FILE__, __LINE__, + "(main) failed to launch target \"%s\": %s\n", + lt_argv_zero, nonnull (strerror (errno))); return 127; } return rval; @@ -3586,7 +4546,7 @@ xmalloc (size_t num) { void *p = (void *) malloc (num); if (!p) - lt_fatal ("Memory exhausted"); + lt_fatal (__FILE__, __LINE__, "memory exhausted"); return p; } @@ -3620,8 +4580,8 @@ check_executable (const char *path) { struct stat st; - LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", - path ? (*path ? path : "EMPTY!") : "NULL!")); + lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", + nonempty (path)); if ((!path) || (!*path)) return 0; @@ -3638,8 +4598,8 @@ make_executable (const char *path) int rval = 0; struct stat st; - LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", - path ? (*path ? path : "EMPTY!") : "NULL!")); + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); if ((!path) || (!*path)) return 0; @@ -3665,8 +4625,8 @@ find_executable (const char *wrapper) int tmp_len; char *concat_name; - LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", - wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; @@ -3719,7 +4679,8 @@ find_executable (const char *wrapper) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); @@ -3744,7 +4705,8 @@ find_executable (const char *wrapper) } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); @@ -3770,8 +4732,9 @@ chase_symlinks (const char *pathspec) int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { - LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", - tmp_pathspec)); + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) @@ -3793,8 +4756,9 @@ chase_symlinks (const char *pathspec) } else { - char *errstr = strerror (errno); - lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); @@ -3807,7 +4771,8 @@ chase_symlinks (const char *pathspec) tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { - lt_fatal ("Could not follow symlinks for %s", pathspec); + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif @@ -3833,11 +4798,25 @@ strendzap (char *str, const char *pat) return str; } +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + static void -lt_error_core (int exit_status, const char *mode, +lt_error_core (int exit_status, const char *file, + int line, const char *mode, const char *message, va_list ap) { - fprintf (stderr, "%s: %s: ", program_name, mode); + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); @@ -3846,20 +4825,32 @@ lt_error_core (int exit_status, const char *mode, } void -lt_fatal (const char *message, ...) +lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + void lt_setenv (const char *name, const char *value) { - LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", - (name ? name : ""), - (value ? value : ""))); + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ @@ -3904,95 +4895,12 @@ lt_extend_str (const char *orig_value, const char *add, int to_end) return new_value; } -int -lt_split_name_value (const char *arg, char** name, char** value) -{ - const char *p; - int len; - if (!arg || !*arg) - return 1; - - p = strchr (arg, (int)'='); - - if (!p) - return 1; - - *value = xstrdup (++p); - - len = strlen (arg) - strlen (*value); - *name = XMALLOC (char, len); - strncpy (*name, arg, len-1); - (*name)[len - 1] = '\0'; - - return 0; -} - -void -lt_opt_process_env_set (const char *arg) -{ - char *name = NULL; - char *value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); - } - - lt_setenv (name, value); - XFREE (name); - XFREE (value); -} - -void -lt_opt_process_env_prepend (const char *arg) -{ - char *name = NULL; - char *value = NULL; - char *new_value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); - } - - new_value = lt_extend_str (getenv (name), value, 0); - lt_setenv (name, new_value); - XFREE (new_value); - XFREE (name); - XFREE (value); -} - -void -lt_opt_process_env_append (const char *arg) -{ - char *name = NULL; - char *value = NULL; - char *new_value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); - } - - new_value = lt_extend_str (getenv (name), value, 1); - lt_setenv (name, new_value); - XFREE (new_value); - XFREE (name); - XFREE (value); -} - void lt_update_exe_path (const char *name, const char *value) { - LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", - (name ? name : ""), - (value ? value : ""))); + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); if (name && *name && value && *value) { @@ -4011,9 +4919,9 @@ lt_update_exe_path (const char *name, const char *value) void lt_update_lib_path (const char *name, const char *value) { - LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", - (name ? name : ""), - (value ? value : ""))); + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); if (name && *name && value && *value) { @@ -4023,11 +4931,152 @@ lt_update_lib_path (const char *name, const char *value) } } +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -e 's/\([\\"]\)/\\\1/g' \ + -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' + cat <<"EOF" +} EOF } # end: func_emit_cwrapperexe_src +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $opt_debug + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + # func_mode_link arg... func_mode_link () { @@ -4072,6 +5121,7 @@ func_mode_link () new_inherited_linker_flags= avoid_version=no + bindir= dlfiles= dlprefiles= dlself=no @@ -4164,6 +5214,11 @@ func_mode_link () esac case $prev in + bindir) + bindir="$arg" + prev= + continue + ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. @@ -4195,9 +5250,9 @@ func_mode_link () ;; *) if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" + func_append dlfiles " $arg" else - dlprefiles="$dlprefiles $arg" + func_append dlprefiles " $arg" fi prev= continue @@ -4221,7 +5276,7 @@ func_mode_link () *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; - *) deplibs="$deplibs $qarg.ltframework" # this is fixed later + *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; @@ -4240,7 +5295,7 @@ func_mode_link () moreargs= for fil in `cat "$save_arg"` do -# moreargs="$moreargs $fil" +# func_append moreargs " $fil" arg=$fil # A libtool-controlled object. @@ -4269,7 +5324,7 @@ func_mode_link () if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" + func_append dlfiles " $pic_object" prev= continue else @@ -4281,7 +5336,7 @@ func_mode_link () # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" + func_append dlprefiles " $pic_object" prev= fi @@ -4351,12 +5406,12 @@ func_mode_link () if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; - *) rpath="$rpath $arg" ;; + *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; + *) func_append xrpath " $arg" ;; esac fi prev= @@ -4368,28 +5423,28 @@ func_mode_link () continue ;; weak) - weak_libs="$weak_libs $arg" + func_append weak_libs " $arg" prev= continue ;; xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) - compiler_flags="$compiler_flags $qarg" + func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" @@ -4425,6 +5480,11 @@ func_mode_link () continue ;; + -bindir) + prev=bindir + continue + ;; + -dlopen) prev=dlfiles continue @@ -4475,15 +5535,16 @@ func_mode_link () ;; -L*) - func_stripname '-L' '' "$arg" - dir=$func_stripname_result - if test -z "$dir"; then + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; @@ -4495,24 +5556,30 @@ func_mode_link () ;; esac case "$deplibs " in - *" -L$dir "*) ;; + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; - *) dllsearchpath="$dllsearchpath:$dir";; + *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; - *) dllsearchpath="$dllsearchpath:$testbindir";; + *) func_append dllsearchpath ":$testbindir";; esac ;; esac @@ -4522,7 +5589,7 @@ func_mode_link () -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; @@ -4536,7 +5603,7 @@ func_mode_link () ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs System.ltframework" + func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) @@ -4556,7 +5623,7 @@ func_mode_link () ;; esac fi - deplibs="$deplibs $arg" + func_append deplibs " $arg" continue ;; @@ -4568,8 +5635,8 @@ func_mode_link () # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. - -model|-arch|-isysroot) - compiler_flags="$compiler_flags $arg" + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler @@ -4577,12 +5644,12 @@ func_mode_link () ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - compiler_flags="$compiler_flags $arg" + func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; + * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; @@ -4649,13 +5716,17 @@ func_mode_link () # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; + *) func_append xrpath " $dir" ;; esac continue ;; @@ -4708,8 +5779,8 @@ func_mode_link () for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" - arg="$arg $wl$func_quote_for_eval_result" - compiler_flags="$compiler_flags $func_quote_for_eval_result" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" @@ -4724,9 +5795,9 @@ func_mode_link () for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" - arg="$arg $wl$func_quote_for_eval_result" - compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" - linker_flags="$linker_flags $func_quote_for_eval_result" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" @@ -4754,23 +5825,27 @@ func_mode_link () arg="$func_quote_for_eval_result" ;; - # -64, -mips[0-9] enable 64-bit mode on the SGI compiler - # -r[0-9][0-9]* specifies the processor on the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler - # +DA*, +DD* enable 64-bit mode on the HP compiler - # -q* pass through compiler args for the IBM compiler - # -m*, -t[45]*, -txscale* pass through architecture-specific - # compiler args for GCC - # -F/path gives path to uninstalled frameworks, gcc on darwin - # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC - # @file GCC response files + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" - compiler_flags="$compiler_flags $arg" + func_append compiler_flags " $arg" continue ;; @@ -4782,7 +5857,7 @@ func_mode_link () *.$objext) # A standard object. - objs="$objs $arg" + func_append objs " $arg" ;; *.lo) @@ -4813,7 +5888,7 @@ func_mode_link () if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" + func_append dlfiles " $pic_object" prev= continue else @@ -4825,7 +5900,7 @@ func_mode_link () # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" + func_append dlprefiles " $pic_object" prev= fi @@ -4870,24 +5945,25 @@ func_mode_link () *.$libext) # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" + func_append deplibs " $arg" + func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. + func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" + func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" + func_append dlprefiles " $func_resolve_sysroot_result" prev= else - deplibs="$deplibs $arg" + func_append deplibs " $func_resolve_sysroot_result" fi continue ;; @@ -4925,7 +6001,7 @@ func_mode_link () if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi @@ -4934,6 +6010,8 @@ func_mode_link () func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" @@ -4954,12 +6032,12 @@ func_mode_link () # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do - if $opt_duplicate_deps ; then + if $opt_preserve_dup_deps ; then case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi - libs="$libs $deplib" + func_append libs " $deplib" done if test "$linkmode" = lib; then @@ -4972,9 +6050,9 @@ func_mode_link () if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac - pre_post_deps="$pre_post_deps $pre_post_dep" + func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= @@ -5041,17 +6119,19 @@ func_mode_link () for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= + func_resolve_sysroot "$lib" case $lib in - *.la) func_source "$lib" ;; + *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do - deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` + func_basename "$deplib" + deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; - *) deplibs="$deplibs $deplib" ;; + *) func_append deplibs " $deplib" ;; esac done done @@ -5072,11 +6152,11 @@ func_mode_link () compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else - compiler_flags="$compiler_flags $deplib" + func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi @@ -5161,7 +6241,7 @@ func_mode_link () if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi @@ -5174,7 +6254,8 @@ func_mode_link () test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then @@ -5188,7 +6269,8 @@ func_mode_link () finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" @@ -5199,17 +6281,21 @@ func_mode_link () -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" - dir=$func_stripname_result + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; + *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; - *.la) lib="$deplib" ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" @@ -5227,7 +6313,7 @@ func_mode_link () match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi @@ -5237,15 +6323,15 @@ func_mode_link () ;; esac if test "$valid_a_lib" != yes; then - $ECHO + echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because the file extensions .$libext of this argument makes me believe" - $ECHO "*** that it is just a static archive that I should not use here." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." else - $ECHO + echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" @@ -5272,11 +6358,11 @@ func_mode_link () if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. - newdlprefiles="$newdlprefiles $deplib" + func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else - newdlfiles="$newdlfiles $deplib" + func_append newdlfiles " $deplib" fi fi continue @@ -5318,20 +6404,20 @@ func_mode_link () # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then - tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; - *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi - dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then @@ -5342,20 +6428,20 @@ func_mode_link () func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" - if $opt_duplicate_deps ; then + if $opt_preserve_dup_deps ; then case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi - tmp_libs="$tmp_libs $deplib" + func_append tmp_libs " $deplib" done continue fi # $pass = conv @@ -5363,9 +6449,15 @@ func_mode_link () # Get the name of the library we link against. linklib= - for l in $old_library $library_names; do - linklib="$l" - done + if test -n "$old_library" && + { test "$prefer_static_libs" = yes || + test "$prefer_static_libs,$installed" = "built,no"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib="$l" + done + fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi @@ -5382,9 +6474,9 @@ func_mode_link () # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" + func_append dlprefiles " $lib $dependency_libs" else - newdlfiles="$newdlfiles $lib" + func_append newdlfiles " $lib" fi continue fi # $pass = dlopen @@ -5406,14 +6498,14 @@ func_mode_link () # Find the relevant object directory and library name. if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else - dir="$libdir" - absdir="$libdir" + dir="$lt_sysroot$libdir" + absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else @@ -5421,12 +6513,12 @@ func_mode_link () dir="$ladir" absdir="$abs_ladir" # Remove this search path later - notinst_path="$notinst_path $abs_ladir" + func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later - notinst_path="$notinst_path $abs_ladir" + func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" @@ -5437,20 +6529,46 @@ func_mode_link () if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" - fi + case "$host" in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac fi # $pass = dlpreopen if test -z "$libdir"; then @@ -5468,7 +6586,7 @@ func_mode_link () if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" + func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no @@ -5481,7 +6599,8 @@ func_mode_link () for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? @@ -5492,12 +6611,12 @@ func_mode_link () # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi - if $opt_duplicate_deps ; then + if $opt_preserve_dup_deps ; then case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi - tmp_libs="$tmp_libs $deplib" + func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... @@ -5512,7 +6631,7 @@ func_mode_link () # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; - *) temp_rpath="$temp_rpath$absdir:" ;; + *) func_append temp_rpath "$absdir:" ;; esac fi @@ -5524,7 +6643,7 @@ func_mode_link () *) case "$compile_rpath " in *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" + *) func_append compile_rpath " $absdir" ;; esac ;; esac @@ -5533,7 +6652,7 @@ func_mode_link () *) case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" + *) func_append finalize_rpath " $libdir" ;; esac ;; esac @@ -5558,12 +6677,12 @@ func_mode_link () case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded - notinst_deplibs="$notinst_deplibs $lib" + func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" + func_append notinst_deplibs " $lib" need_relink=yes fi ;; @@ -5580,7 +6699,7 @@ func_mode_link () fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then - $ECHO + echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else @@ -5598,7 +6717,7 @@ func_mode_link () *) case "$compile_rpath " in *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" + *) func_append compile_rpath " $absdir" ;; esac ;; esac @@ -5607,7 +6726,7 @@ func_mode_link () *) case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" + *) func_append finalize_rpath " $libdir" ;; esac ;; esac @@ -5661,7 +6780,7 @@ func_mode_link () linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" - if test "$linkmode" = prog || test "$mode" != relink; then + if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= @@ -5683,9 +6802,9 @@ func_mode_link () if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then - $ECHO - $ECHO "*** And there doesn't seem to be a static archive available" - $ECHO "*** The link will probably fail, sorry" + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi @@ -5717,7 +6836,7 @@ func_mode_link () if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" + func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi @@ -5739,7 +6858,7 @@ func_mode_link () if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then @@ -5753,13 +6872,13 @@ func_mode_link () test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi - if test "$linkmode" = prog || test "$mode" = relink; then + if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= @@ -5773,7 +6892,7 @@ func_mode_link () elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then @@ -5790,7 +6909,7 @@ func_mode_link () if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" + func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi @@ -5825,21 +6944,21 @@ func_mode_link () # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. - $ECHO + echo $ECHO "*** Warning: This system can not link to static lib archive $lib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then - $ECHO "*** But as you try to build a module library, libtool will still create " - $ECHO "*** a static module, that should work as long as the dlopening application" - $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then - $ECHO - $ECHO "*** However, this would only work if libtool was able to extract symbol" - $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" - $ECHO "*** not find such a program. So, this module is probably useless." - $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module @@ -5867,37 +6986,46 @@ func_mode_link () temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; + *) func_append xrpath " $temp_xrpath";; esac;; - *) temp_deplibs="$temp_deplibs $libdir";; + *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi - newlib_search_path="$newlib_search_path $absdir" + func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" - if $opt_duplicate_deps ; then + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps ; then case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi - tmp_libs="$tmp_libs $deplib" + func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do + path= case $deplib in -L*) path="$deplib" ;; *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." - dir="$func_dirname_result" + dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; @@ -5924,8 +7052,8 @@ func_mode_link () if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi - compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" - linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" + func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi @@ -5958,7 +7086,7 @@ func_mode_link () compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else - compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" @@ -5975,7 +7103,7 @@ func_mode_link () for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; + *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= @@ -6033,10 +7161,10 @@ func_mode_link () -L*) case " $tmp_libs " in *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; + *) func_append tmp_libs " $deplib" ;; esac ;; - *) tmp_libs="$tmp_libs $deplib" ;; + *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" @@ -6052,7 +7180,7 @@ func_mode_link () ;; esac if test -n "$i" ; then - tmp_libs="$tmp_libs $i" + func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs @@ -6093,7 +7221,7 @@ func_mode_link () # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" - objs="$objs$old_deplibs" + func_append objs "$old_deplibs" ;; lib) @@ -6126,10 +7254,10 @@ func_mode_link () if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else - $ECHO + echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" - libobjs="$libobjs $objs" + func_append libobjs " $objs" fi fi @@ -6194,7 +7322,7 @@ func_mode_link () age="$number_minor" revision="$number_revision" ;; - freebsd-aout|freebsd-elf|sunos) + freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" @@ -6327,7 +7455,7 @@ func_mode_link () done # Make executables depend on our current version. - verstring="$verstring:${current}.0" + func_append verstring ":${current}.0" ;; qnx) @@ -6395,10 +7523,10 @@ func_mode_link () fi func_generate_dlsyms "$libname" "$libname" "yes" - libobjs="$libobjs $symfileobj" + func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= - if test "$mode" != relink; then + if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= @@ -6414,7 +7542,7 @@ func_mode_link () continue fi fi - removelist="$removelist $p" + func_append removelist " $p" ;; *) ;; esac @@ -6425,27 +7553,28 @@ func_mode_link () # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" + func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do - # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` - # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` - # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; + *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then @@ -6459,7 +7588,7 @@ func_mode_link () for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; + *) func_append dlfiles " $lib" ;; esac done @@ -6469,19 +7598,19 @@ func_mode_link () for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; + *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework - deplibs="$deplibs System.ltframework" + func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. @@ -6498,7 +7627,7 @@ func_mode_link () *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" + func_append deplibs " -lc" fi ;; esac @@ -6547,7 +7676,7 @@ EOF if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" i="" ;; esac @@ -6558,21 +7687,21 @@ EOF set dummy $deplib_matches; shift deplib_match=$1 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" else droppeddeps=yes - $ECHO + echo $ECHO "*** Warning: dynamic linker does not accept needed library $i." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which I believe you do not have" - $ECHO "*** because a test_compile did reveal that the linker did not use it for" - $ECHO "*** its dynamic dependency list that programs get resolved with at runtime." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which I believe you do not have" + echo "*** because a test_compile did reveal that the linker did not use it for" + echo "*** its dynamic dependency list that programs get resolved with at runtime." fi fi ;; *) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" ;; esac done @@ -6590,7 +7719,7 @@ EOF if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" i="" ;; esac @@ -6601,29 +7730,29 @@ EOF set dummy $deplib_matches; shift deplib_match=$1 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" else droppeddeps=yes - $ECHO + echo $ECHO "*** Warning: dynamic linker does not accept needed library $i." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because a test_compile did reveal that the linker did not use this one" - $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because a test_compile did reveal that the linker did not use this one" + echo "*** as a dynamic dependency that programs can get resolved with at runtime." fi fi else droppeddeps=yes - $ECHO + echo $ECHO "*** Warning! Library $i is needed by this library but I was not able to" - $ECHO "*** make it link in! You will probably need to install it or some" - $ECHO "*** library that it depends on before this library will be fully" - $ECHO "*** functional. Installing it before continuing would be even better." + echo "*** make it link in! You will probably need to install it or some" + echo "*** library that it depends on before this library will be fully" + echo "*** functional. Installing it before continuing would be even better." fi ;; *) - newdeplibs="$newdeplibs $i" + func_append newdeplibs " $i" ;; esac done @@ -6640,15 +7769,27 @@ EOF if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` + if test -n "$file_magic_glob"; then + libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` + else + libnameglob=$libname + fi + test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + if test "$want_nocaseglob" = yes; then + shopt -s nocaseglob + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | @@ -6665,13 +7806,13 @@ EOF potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi @@ -6680,12 +7821,12 @@ EOF fi if test -n "$a_deplib" ; then droppeddeps=yes - $ECHO + echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because I did check the linker path looking for a file starting" + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else @@ -6696,7 +7837,7 @@ EOF ;; *) # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. @@ -6712,7 +7853,7 @@ EOF if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" ;; esac @@ -6723,9 +7864,9 @@ EOF potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test - if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi @@ -6734,12 +7875,12 @@ EOF fi if test -n "$a_deplib" ; then droppeddeps=yes - $ECHO + echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because I did check the linker path looking for a file starting" + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else @@ -6750,32 +7891,32 @@ EOF ;; *) # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" + func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" - tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ - -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi - if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | - $GREP . >/dev/null; then - $ECHO + case $tmp_deplibs in + *[!\ \ ]*) + echo if test "X$deplibs_check_method" = "Xnone"; then - $ECHO "*** Warning: inter-library dependencies are not supported in this platform." + echo "*** Warning: inter-library dependencies are not supported in this platform." else - $ECHO "*** Warning: inter-library dependencies are not known to be supported." + echo "*** Warning: inter-library dependencies are not known to be supported." fi - $ECHO "*** All declared inter-library dependencies are being dropped." + echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes - fi + ;; + esac ;; esac versuffix=$versuffix_save @@ -6787,23 +7928,23 @@ EOF case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework - newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then - $ECHO - $ECHO "*** Warning: libtool could not satisfy all declared inter-library" + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" - $ECHO "*** a static module, that should work as long as the dlopening" - $ECHO "*** application is linked with the -dlopen flag." + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then - $ECHO - $ECHO "*** However, this would only work if libtool was able to extract symbol" - $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" - $ECHO "*** not find such a program. So, this module is probably useless." - $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" @@ -6813,16 +7954,16 @@ EOF build_libtool_libs=no fi else - $ECHO "*** The inter-library dependencies that have been dropped here will be" - $ECHO "*** automatically added whenever a program is linked with this library" - $ECHO "*** or is declared to -dlopen it." + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then - $ECHO - $ECHO "*** Since this library must not contain undefined symbols," - $ECHO "*** because either the platform does not support them or" - $ECHO "*** it was explicitly requested with -no-undefined," - $ECHO "*** libtool will only create a static version of it." + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module @@ -6839,9 +7980,9 @@ EOF # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) - newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac @@ -6854,7 +7995,7 @@ EOF *) case " $deplibs " in *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; + func_append new_libs " -L$path/$objdir" ;; esac ;; esac @@ -6864,10 +8005,10 @@ EOF -L*) case " $new_libs " in *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" @@ -6884,10 +8025,12 @@ EOF hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" + test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else @@ -6896,18 +8039,18 @@ EOF *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - dep_rpath="$dep_rpath $flag" + func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; + *) func_apped perm_rpath " $libdir" ;; esac fi done @@ -6925,7 +8068,7 @@ EOF # We should set the runpath_var. rpath= for dir in $perm_rpath; do - rpath="$rpath$dir:" + func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi @@ -6933,7 +8076,7 @@ EOF fi shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi @@ -6959,18 +8102,18 @@ EOF linknames= for link do - linknames="$linknames $link" + func_append linknames " $link" done # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" - delfiles="$delfiles $export_symbols" + func_append delfiles " $export_symbols" fi orig_export_symbols= @@ -7001,13 +8144,45 @@ EOF $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do + for cmd1 in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" - func_len " $cmd" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test "$try_normal_branch" = yes \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=${output_objdir}/${output_la}.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. @@ -7029,7 +8204,7 @@ EOF if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then @@ -7041,7 +8216,7 @@ EOF # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi @@ -7051,7 +8226,7 @@ EOF case " $convenience " in *" $test_deplib "*) ;; *) - tmp_deplibs="$tmp_deplibs $test_deplib" + func_append tmp_deplibs " $test_deplib" ;; esac done @@ -7071,21 +8246,21 @@ EOF test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $convenience - libobjs="$libobjs $func_extract_archives_result" + func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" - linker_flags="$linker_flags $flag" + func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking - if test "$mode" = relink; then + if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi @@ -7130,7 +8305,8 @@ EOF save_libobjs=$libobjs fi save_output=$output - output_la=`$ECHO "X$output" | $Xsed -e "$basename"` + func_basename "$output" + output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. @@ -7143,13 +8319,16 @@ EOF if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" - $ECHO 'INPUT (' > $output + echo 'INPUT (' > $output for obj in $save_libobjs do - $ECHO "$obj" >> $output + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output done - $ECHO ')' >> $output - delfiles="$delfiles $output" + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" @@ -7163,10 +8342,12 @@ EOF fi for obj do - $ECHO "$obj" >> $output + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output done - delfiles="$delfiles $output" - output=$firstobj\"$file_list_spec$output\" + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." @@ -7190,17 +8371,19 @@ EOF # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. - eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. - eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext - objlist=$obj + objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result @@ -7210,11 +8393,12 @@ EOF # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi - delfiles="$delfiles $output" + func_append delfiles " $output" else output= @@ -7248,7 +8432,7 @@ EOF lt_exit=$? # Restore the uninstalled library and exit - if test "$mode" = relink; then + if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) @@ -7269,7 +8453,7 @@ EOF if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then @@ -7281,7 +8465,7 @@ EOF # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi @@ -7322,10 +8506,10 @@ EOF # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $dlprefiles - libobjs="$libobjs $func_extract_archives_result" + func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi @@ -7341,7 +8525,7 @@ EOF lt_exit=$? # Restore the uninstalled library and exit - if test "$mode" = relink; then + if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) @@ -7353,7 +8537,7 @@ EOF IFS="$save_ifs" # Restore the uninstalled library and exit - if test "$mode" = relink; then + if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then @@ -7434,18 +8618,21 @@ EOF if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` + reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi + # If we're not building shared, we need to use non_pic_objs + test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" + # Create the old-style object. - reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' @@ -7505,8 +8692,8 @@ EOF case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework - compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` - finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac @@ -7517,14 +8704,14 @@ EOF if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" + func_append compile_command " ${wl}-bind_at_load" + func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" - compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac @@ -7538,7 +8725,7 @@ EOF *) case " $compile_deplibs " in *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; + func_append new_libs " -L$path/$objdir" ;; esac ;; esac @@ -7548,17 +8735,17 @@ EOF -L*) case " $new_libs " in *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac ;; - *) new_libs="$new_libs $deplib" ;; + *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" - compile_command="$compile_command $compile_deplibs" - finalize_command="$finalize_command $finalize_deplibs" + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. @@ -7566,7 +8753,7 @@ EOF # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; + *) func_append finalize_rpath " $libdir" ;; esac done fi @@ -7585,18 +8772,18 @@ EOF *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" + func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; + *) func_append perm_rpath " $libdir" ;; esac fi case $host in @@ -7605,12 +8792,12 @@ EOF case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; - *) dllsearchpath="$dllsearchpath:$libdir";; + *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; - *) dllsearchpath="$dllsearchpath:$testbindir";; + *) func_append dllsearchpath ":$testbindir";; esac ;; esac @@ -7636,18 +8823,18 @@ EOF *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" + func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + *) func_append finalize_perm_rpath " $libdir" ;; esac fi done @@ -7661,8 +8848,8 @@ EOF if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. - compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" @@ -7674,15 +8861,15 @@ EOF wrappers_required=yes case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=no + ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; - *cegcc) - # Disable wrappers for cegcc, we are cross compiling anyway. - wrappers_required=no - ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no @@ -7691,13 +8878,19 @@ EOF esac if test "$wrappers_required" = no; then # Replace the output file specification. - compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' @@ -7720,7 +8913,7 @@ EOF # We should set the runpath_var. rpath= for dir in $perm_rpath; do - rpath="$rpath$dir:" + func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi @@ -7728,7 +8921,7 @@ EOF # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" + func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi @@ -7738,11 +8931,18 @@ EOF # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. - link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + exit $EXIT_SUCCESS fi @@ -7757,7 +8957,7 @@ EOF if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then - relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= @@ -7769,13 +8969,19 @@ EOF fi # Replace the output file specification. - link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + # Now create the wrapper script. func_verbose "creating $output" @@ -7793,18 +8999,7 @@ EOF fi done relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $ECHO for shipping. - if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then - case $progpath in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; - *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; - esac - qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` - else - qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. @@ -7884,7 +9079,7 @@ EOF else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then - oldobjs="$oldobjs $symfileobj" + func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" @@ -7892,10 +9087,10 @@ EOF if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $addlibs - oldobjs="$oldobjs $func_extract_archives_result" + func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. @@ -7906,10 +9101,10 @@ EOF # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_extract_archives $gentop $dlprefiles - oldobjs="$oldobjs $func_extract_archives_result" + func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have @@ -7925,9 +9120,9 @@ EOF done | sort | sort -uc >/dev/null 2>&1); then : else - $ECHO "copying selected object files to avoid basename conflicts..." + echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" + func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= @@ -7951,9 +9146,9 @@ EOF esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" ;; - *) oldobjs="$oldobjs $obj" ;; + *) func_append oldobjs " $obj" ;; esac done fi @@ -7963,6 +9158,16 @@ EOF len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." @@ -8036,7 +9241,7 @@ EOF done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi @@ -8059,9 +9264,19 @@ EOF eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" - newdependency_libs="$newdependency_libs $libdir/$name" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" @@ -8075,9 +9290,9 @@ EOF eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" - newdlfiles="$newdlfiles $libdir/$name" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; - *) newdlfiles="$newdlfiles $lib" ;; + *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" @@ -8094,7 +9309,7 @@ EOF eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" - newdlprefiles="$newdlprefiles $libdir/$name" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done @@ -8106,7 +9321,7 @@ EOF [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac - newdlfiles="$newdlfiles $abs" + func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= @@ -8115,15 +9330,33 @@ EOF [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac - newdlprefiles="$newdlprefiles $abs" + func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test "x$bindir" != x ; + then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; esac $ECHO > $output "\ # $outputname - a libtool library file @@ -8182,7 +9415,7 @@ relink_command=\"$relink_command\"" exit $EXIT_SUCCESS } -{ test "$mode" = link || test "$mode" = relink; } && +{ test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} @@ -8202,9 +9435,9 @@ func_mode_uninstall () for arg do case $arg in - -f) RM="$RM $arg"; rmforce=yes ;; - -*) RM="$RM $arg" ;; - *) files="$files $arg" ;; + -f) func_append RM " $arg"; rmforce=yes ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; esac done @@ -8213,24 +9446,23 @@ func_mode_uninstall () rmdirs= - origobjdir="$objdir" for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then - objdir="$origobjdir" + odir="$objdir" else - objdir="$dir/$origobjdir" + odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" - test "$mode" = uninstall && objdir="$dir" + test "$opt_mode" = uninstall && odir="$dir" - # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then + # Remember odir for removal later, being careful to avoid duplicates + if test "$opt_mode" = clean; then case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; esac fi @@ -8256,18 +9488,17 @@ func_mode_uninstall () # Delete the libtool libraries and symlinks. for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" + func_append rmfiles " $odir/$n" done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + test -n "$old_library" && func_append rmfiles " $odir/$old_library" - case "$mode" in + case "$opt_mode" in clean) - case " $library_names " in - # " " in the beginning catches empty $dlname + case " $library_names " in *" $dlname "*) ;; - *) rmfiles="$rmfiles $objdir/$dlname" ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac - test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then @@ -8295,19 +9526,19 @@ func_mode_uninstall () # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" + func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" + func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) - if test "$mode" = clean ; then + if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) @@ -8317,7 +9548,7 @@ func_mode_uninstall () noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe - rmfiles="$rmfiles $file" + func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. @@ -8326,7 +9557,7 @@ func_mode_uninstall () func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result - rmfiles="$rmfiles $func_ltwrapper_scriptname_result" + func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename @@ -8334,12 +9565,12 @@ func_mode_uninstall () # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" + func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" + func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi @@ -8347,7 +9578,6 @@ func_mode_uninstall () esac func_show_eval "$RM $rmfiles" 'exit_status=1' done - objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do @@ -8359,16 +9589,16 @@ func_mode_uninstall () exit $exit_status } -{ test "$mode" = uninstall || test "$mode" = clean; } && +{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} -test -z "$mode" && { +test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$mode'" + func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" diff --git a/missing b/build-aux/missing similarity index 100% rename from missing rename to build-aux/missing diff --git a/configure b/configure index 67f3cde..65baa4e 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for udev 166. +# Generated by GNU Autoconf 2.68 for udev 174. # # Report bugs to . # @@ -174,7 +174,15 @@ test x\$exitcode = x0 || exit 1" as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" +test \$(( 1 + 1 )) = 2 || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else @@ -536,155 +544,8 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} -case X$lt_ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` - ;; -esac - -ECHO=${lt_ECHO-echo} -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<_LT_EOF -$* -_LT_EOF - exit 0 -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test -z "$lt_ECHO"; then - if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if { echo_test_string=`eval $cmd`; } 2>/dev/null && - { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null - then - break - fi - done - fi - - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : - else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$ECHO" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - ECHO='print -r' - elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} - else - # Try using printf. - ECHO='printf %s\n' - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - ECHO="$CONFIG_SHELL $0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$CONFIG_SHELL $0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do - if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "$0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} - else - # Oops. We lost completely, so just stick with echo. - ECHO=echo - fi - fi - fi - fi - fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -lt_ECHO=$ECHO -if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then - lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" -fi - - - test -n "$DJDIR" || exec 7<&0 &1 @@ -709,11 +570,12 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='udev' PACKAGE_TARNAME='udev' -PACKAGE_VERSION='166' -PACKAGE_STRING='udev 166' +PACKAGE_VERSION='174' +PACKAGE_STRING='udev 174' PACKAGE_BUGREPORT='linux-hotplug@vger.kernel.org' -PACKAGE_URL='' +PACKAGE_URL='http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html' +ac_unique_file="udev/udevd.c" # Factoring default headers for most tests. ac_includes_default="\ #include @@ -755,6 +617,28 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +ENABLE_EDD_FALSE +ENABLE_EDD_TRUE +ENABLE_FLOPPY_FALSE +ENABLE_FLOPPY_TRUE +ENABLE_UDEV_ACL_FALSE +ENABLE_UDEV_ACL_TRUE +ENABLE_RULE_GENERATOR_FALSE +ENABLE_RULE_GENERATOR_TRUE +ENABLE_MTD_PROBE_FALSE +ENABLE_MTD_PROBE_TRUE +ENABLE_KEYMAP_FALSE +ENABLE_KEYMAP_TRUE +INCLUDE_PREFIX +GPERF +ENABLE_HWDB_FALSE +ENABLE_HWDB_TRUE +PCI_DATABASE +USB_DATABASE +USBUTILS_LIBS +USBUTILS_CFLAGS +ENABLE_GUDEV_FALSE +ENABLE_GUDEV_TRUE ENABLE_INTROSPECTION_FALSE ENABLE_INTROSPECTION_TRUE GIRTYPELIBDIR @@ -764,18 +648,8 @@ G_IR_COMPILER G_IR_SCANNER INTROSPECTION_LIBS INTROSPECTION_CFLAGS -ENABLE_EXTRAS_FALSE -ENABLE_EXTRAS_TRUE -INCLUDE_PREFIX -PCI_DATABASE -USB_DATABASE -USBUTILS_LIBS -USBUTILS_CFLAGS -LIBUSB_LIBS -LIBUSB_CFLAGS GLIB_LIBS GLIB_CFLAGS -GPERF WITH_SYSTEMD_FALSE WITH_SYSTEMD_TRUE systemdsystemunitdir @@ -795,21 +669,25 @@ GTK_DOC_BUILD_HTML_FALSE GTK_DOC_BUILD_HTML_TRUE ENABLE_GTK_DOC_FALSE ENABLE_GTK_DOC_TRUE -PKG_CONFIG_LIBDIR -PKG_CONFIG_PATH -PKG_CONFIG +GTKDOC_DEPS_LIBS +GTKDOC_DEPS_CFLAGS HTML_DIR GTKDOC_MKPDF GTKDOC_REBASE GTKDOC_CHECK +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL -lt_ECHO +MANIFEST_TOOL RANLIB +ac_ct_AR AR +DLLTOOL OBJDUMP LN_S NM @@ -920,6 +798,7 @@ enable_shared with_pic enable_fast_install with_gnu_ld +with_sysroot enable_libtool_lock with_html_dir enable_gtk_doc @@ -931,9 +810,17 @@ enable_debug enable_logging with_firmware_path with_systemdsystemunitdir -enable_extras -with_pci_ids_path +enable_gudev enable_introspection +enable_hwdb +with_usb_ids_path +with_pci_ids_path +enable_keymap +enable_mtd_probe +enable_rule_generator +enable_udev_acl +enable_floppy +enable_edd ' ac_precious_vars='build_alias host_alias @@ -947,14 +834,14 @@ CPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR +GTKDOC_DEPS_CFLAGS +GTKDOC_DEPS_LIBS GLIB_CFLAGS GLIB_LIBS -LIBUSB_CFLAGS -LIBUSB_LIBS -USBUTILS_CFLAGS -USBUTILS_LIBS INTROSPECTION_CFLAGS -INTROSPECTION_LIBS' +INTROSPECTION_LIBS +USBUTILS_CFLAGS +USBUTILS_LIBS' # Initialize some variables set by options. @@ -1497,7 +1384,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures udev 166 to adapt to many kinds of systems. +\`configure' configures udev 174 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1567,7 +1454,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of udev 166:";; + short | recursive ) echo "Configuration of udev 174:";; esac cat <<\_ACEOF @@ -1590,8 +1477,15 @@ Optional Features: --enable-gtk-doc-pdf build documentation in pdf format [[default=no]] --enable-debug enable debug messages --disable-logging disable system logging - --disable-extras disable extras with external dependencies + --disable-gudev disable Gobject libudev support --disable-introspection disable GObject introspection + --disable-hwdb disable hardware database support + --disable-keymap disable keymap fixup support + --disable-mtd_probe disable MTD support + --enable-rule_generator enable persistent network + cdrom links support + --enable-udev_acl enable local user acl permissions support + --enable-floppy enable legacy floppy support + --enable-edd enable disk edd support Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1599,6 +1493,8 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot=DIR Search for dependent libraries within DIR + (or the compiler's sysroot if not specified). --with-html-dir=PATH path to installed docs --with-rootlibdir=DIR rootfs directory to install shared libraries --with-selinux enable SELinux support @@ -1607,6 +1503,7 @@ Optional Packages: (default=/lib/firmware/updates:/lib/firmware) --with-systemdsystemunitdir=DIR Directory for systemd service files + --with-usb-ids-path=DIR Path to usb.ids file --with-pci-ids-path=DIR Path to pci.ids file Some influential environment variables: @@ -1623,24 +1520,26 @@ Some influential environment variables: directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path + GTKDOC_DEPS_CFLAGS + C compiler flags for GTKDOC_DEPS, overriding pkg-config + GTKDOC_DEPS_LIBS + linker flags for GTKDOC_DEPS, overriding pkg-config GLIB_CFLAGS C compiler flags for GLIB, overriding pkg-config GLIB_LIBS linker flags for GLIB, overriding pkg-config - LIBUSB_CFLAGS - C compiler flags for LIBUSB, overriding pkg-config - LIBUSB_LIBS linker flags for LIBUSB, overriding pkg-config - USBUTILS_CFLAGS - C compiler flags for USBUTILS, overriding pkg-config - USBUTILS_LIBS - linker flags for USBUTILS, overriding pkg-config INTROSPECTION_CFLAGS C compiler flags for INTROSPECTION, overriding pkg-config INTROSPECTION_LIBS linker flags for INTROSPECTION, overriding pkg-config + USBUTILS_CFLAGS + C compiler flags for USBUTILS, overriding pkg-config + USBUTILS_LIBS + linker flags for USBUTILS, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . +udev home page: . _ACEOF ac_status=$? fi @@ -1703,7 +1602,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -udev configure 166 +udev configure 174 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2072,7 +1971,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by udev $as_me 166, which was +It was created by udev $as_me 174, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2421,10 +2320,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -am__api_version='1.11' - ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do +for ac_dir in build-aux "$srcdir"/build-aux; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" @@ -2440,7 +2337,7 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do fi done if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in build-aux \"$srcdir\"/build-aux" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -2452,6 +2349,8 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. +am__api_version='1.11' + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -2866,6 +2765,18 @@ else fi rmdir .tst 2>/dev/null +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in +yes) AM_DEFAULT_VERBOSITY=0;; +no) AM_DEFAULT_VERBOSITY=1;; +*) AM_DEFAULT_VERBOSITY=1;; +esac +AM_BACKSLASH='\' + if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." @@ -2888,7 +2799,7 @@ fi # Define the identity of the package. PACKAGE='udev' - VERSION='166' + VERSION='174' cat >>confdefs.h <<_ACEOF @@ -2922,23 +2833,92 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} AMTAR=${AMTAR-"${am_missing_run}tar"} -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' - +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create a pax tar archive" >&5 +$as_echo_n "checking how to create a pax tar archive... " >&6; } +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' +_am_tools=${am_cv_prog_tar_pax-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + { echo "$as_me:$LINENO: $_am_tar --version" >&5 + ($_am_tar --version) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && break + done + am__tar="$_am_tar --format=posix -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=posix -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x pax -w "$$tardir"' + am__tar_='pax -L -x pax -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H pax -L' + am__tar_='find "$tardir" -print | cpio -o -H pax -L' + am__untar='cpio -i -H pax -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_pax}" && break + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5 + (tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + rm -rf conftest.dir + if test -s conftest.tar; then + { echo "$as_me:$LINENO: $am__untar &5 + ($am__untar &5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + grep GrepMe conftest.dir/file >/dev/null 2>&1 && break + fi +done +rm -rf conftest.dir -# Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : - enableval=$enable_silent_rules; +if ${am_cv_prog_tar_pax+:} false; then : + $as_echo_n "(cached) " >&6 +else + am_cv_prog_tar_pax=$_am_tool fi -case $enable_silent_rules in -yes) AM_DEFAULT_VERBOSITY=0;; -no) AM_DEFAULT_VERBOSITY=1;; -*) AM_DEFAULT_VERBOSITY=0;; -esac -AM_BACKSLASH='\' +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_pax" >&5 +$as_echo "$am_cv_prog_tar_pax" >&6; } + + + + # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : @@ -4608,6 +4588,18 @@ rm -rf conftest* fi +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in +yes) AM_DEFAULT_VERBOSITY=0;; +no) AM_DEFAULT_VERBOSITY=1;; +*) AM_DEFAULT_VERBOSITY=0;; +esac +AM_BACKSLASH='\' + case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 @@ -4616,8 +4608,8 @@ esac -macro_version='2.2.6b' -macro_revision='1.3017' +macro_version='2.4' +macro_revision='1.3293' @@ -4704,6 +4696,75 @@ IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case "$ECHO" in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : @@ -5039,8 +5100,11 @@ if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$ac_tool_prefix"; then - for ac_prog in "dumpbin -symbols" "link -dump -symbols" + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 @@ -5084,7 +5148,7 @@ fi fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in "dumpbin -symbols" "link -dump -symbols" + for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -5139,6 +5203,15 @@ esac fi fi + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" @@ -5158,13 +5231,13 @@ if ${lt_cv_nm_interface+:} false; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:5161: $ac_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:5164: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:5167: output\"" >&5) + (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5221,6 +5294,11 @@ else lt_cv_sys_max_cmd_len=8192; ;; + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. @@ -5285,8 +5363,8 @@ else # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ - = "XX$teststring$teststring"; } >/dev/null 2>&1 && + while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` @@ -5328,8 +5406,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,, \ + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes @@ -5378,6 +5456,80 @@ esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : @@ -5394,6 +5546,11 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' @@ -5557,16 +5714,18 @@ mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -cegcc) +cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' @@ -5596,6 +5755,10 @@ gnu*) lt_cv_deplibs_check_method=pass_all ;; +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in @@ -5604,11 +5767,11 @@ hpux10.20* | hpux11*) lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac @@ -5630,7 +5793,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be Linux ELF. -linux* | k*bsd*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; @@ -5711,6 +5874,21 @@ esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -5726,15 +5904,168 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -5744,7 +6075,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AR="${ac_tool_prefix}ar" + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5764,11 +6095,15 @@ $as_echo "no" >&6; } fi + test -n "$AR" && break + done fi -if test -z "$ac_cv_prog_AR"; then +if test -z "$AR"; then ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : @@ -5784,7 +6119,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_AR="ar" + ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5803,6 +6138,10 @@ else $as_echo "no" >&6; } fi + + test -n "$ac_ct_AR" && break +done + if test "x$ac_ct_AR" = x; then AR="false" else @@ -5814,12 +6153,12 @@ ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi -else - AR="$ac_cv_prog_AR" fi -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru +: ${AR=ar} +: ${AR_FLAGS=cru} + + @@ -5829,6 +6168,62 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + if test -n "$ac_tool_prefix"; then @@ -6046,6 +6441,18 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + @@ -6153,8 +6560,8 @@ esac lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= @@ -6190,6 +6597,7 @@ for ac_symprfx in "" "_"; do else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no @@ -6215,8 +6623,8 @@ _LT_EOF test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then @@ -6231,6 +6639,18 @@ _LT_EOF if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + #ifdef __cplusplus extern "C" { #endif @@ -6242,7 +6662,7 @@ _LT_EOF cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ -const struct { +LT_DLSYM_CONST struct { const char *name; void *address; } @@ -6268,8 +6688,8 @@ static const void *lt_preloaded_setup() { _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 @@ -6279,8 +6699,8 @@ _LT_EOF test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi @@ -6317,6 +6737,27 @@ else $as_echo "ok" >&6; } fi +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + @@ -6329,10 +6770,38 @@ fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; +else + with_sysroot=no +fi +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 +$as_echo "${with_sysroot}" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } @@ -6369,7 +6838,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 6372 "configure"' > conftest.$ac_ext + echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6531,19 +7000,16 @@ esac need_locks="$enable_libtool_lock" - - case $host_os in - rhapsody* | darwin*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. -set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DSYMUTIL+:} false; then : +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$DSYMUTIL"; then - ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -6552,7 +7018,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -6562,10 +7028,10 @@ IFS=$as_save_IFS fi fi -DSYMUTIL=$ac_cv_prog_DSYMUTIL -if test -n "$DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 -$as_echo "$DSYMUTIL" >&6; } +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -6573,17 +7039,17 @@ fi fi -if test -z "$ac_cv_prog_DSYMUTIL"; then - ac_ct_DSYMUTIL=$DSYMUTIL - # Extract the first word of "dsymutil", so it can be a program name with args. -set dummy dsymutil; ac_word=$2 +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_DSYMUTIL"; then - ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -6592,7 +7058,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -6602,17 +7068,17 @@ IFS=$as_save_IFS fi fi -ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL -if test -n "$ac_ct_DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 -$as_echo "$ac_ct_DSYMUTIL" >&6; } +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_DSYMUTIL" = x; then - DSYMUTIL=":" + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -6620,22 +7086,50 @@ yes:) $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - DSYMUTIL=$ac_ct_DSYMUTIL + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else - DSYMUTIL="$ac_cv_prog_DSYMUTIL" + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi + + + + + + case $host_os in + rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. -set dummy ${ac_tool_prefix}nmedit; ac_word=$2 + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_NMEDIT+:} false; then : +if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$NMEDIT"; then - ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -6644,7 +7138,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -6654,8 +7148,100 @@ IFS=$as_save_IFS fi fi -NMEDIT=$ac_cv_prog_NMEDIT -if test -n "$NMEDIT"; then +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else @@ -7081,6 +7667,38 @@ rm -f core conftest.err conftest.$ac_objext \ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; @@ -7108,7 +7726,7 @@ $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi - if test "$DSYMUTIL" != ":"; then + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= @@ -7131,6 +7749,8 @@ done + + # Set options @@ -7253,6 +7873,7 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' + test -z "$LN_S" && LN_S="ln -s" @@ -7302,19 +7923,6 @@ _ACEOF - - - - - - - - - - - - - case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some @@ -7327,23 +7935,6 @@ aix3*) ;; esac -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - # Global variables: ofile=libtool can_build_shared=yes @@ -7372,7 +7963,7 @@ for cc_temp in $compiler""; do *) break;; esac done -cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it @@ -7581,7 +8172,12 @@ if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag=' -fno-builtin' + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } @@ -7601,15 +8197,15 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7604: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7608: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes @@ -7638,8 +8234,6 @@ fi lt_prog_compiler_pic= lt_prog_compiler_static= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' @@ -7687,6 +8281,12 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='-fno-common' ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag @@ -7729,6 +8329,13 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='-fPIC' ;; esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + lt_prog_compiler_pic='-Xcompiler -fPIC' + ;; + esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in @@ -7770,7 +8377,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_static='-non_shared' ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -7791,7 +8398,13 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; - pgcc* | pgf77* | pgf90* | pgf95*) + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' @@ -7803,25 +8416,25 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; - xl*) - # IBM XL C 8.0/Fortran 10.1 on PPC + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C 5.9 + *Sun\ F* | *Sun*Fortran*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_wl='' ;; - *Sun\ F*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker + *Sun\ C*) + # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' + lt_prog_compiler_wl='-Wl,' ;; esac ;; @@ -7853,7 +8466,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in - f77* | f90* | f95*) + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; @@ -7910,13 +8523,17 @@ case $host_os in lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 -$as_echo "$lt_prog_compiler_pic" >&6; } - - - - +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. @@ -7940,15 +8557,15 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7943: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7947: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes @@ -7977,6 +8594,11 @@ fi + + + + + # # Check to make sure the static flag actually works. # @@ -7996,7 +8618,7 @@ else if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 - $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes @@ -8045,16 +8667,16 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8048: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8052: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes @@ -8100,16 +8722,16 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8103: $lt_compile\"" >&5) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8107: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes @@ -8222,7 +8844,33 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie esac ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' @@ -8240,6 +8888,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie fi supports_anon_versioning=no case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... @@ -8255,11 +8904,12 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie ld_shlibs=no cat <<_LT_EOF 1>&2 -*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. _LT_EOF fi @@ -8295,10 +8945,12 @@ _LT_EOF # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -8316,6 +8968,11 @@ _LT_EOF fi ;; + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no @@ -8331,7 +8988,7 @@ _LT_EOF archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; - gnu* | linux* | tpf* | k*bsd*-gnu) + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in @@ -8341,15 +8998,16 @@ _LT_EOF if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then - tmp_addflag= + tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -8360,13 +9018,17 @@ _LT_EOF lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; - xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 @@ -8382,17 +9044,17 @@ _LT_EOF fi case $cc_basename in - xlf*) + xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' - archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac @@ -8406,8 +9068,8 @@ _LT_EOF archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; @@ -8425,8 +9087,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi @@ -8472,8 +9134,8 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi @@ -8513,8 +9175,10 @@ _LT_EOF else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi @@ -8601,7 +9265,13 @@ _LT_EOF allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -8614,25 +9284,32 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' @@ -8641,7 +9318,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else # Determine the default libpath from the value encoded in an # empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -8654,30 +9337,42 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' @@ -8709,20 +9404,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes=yes + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac ;; darwin* | rhapsody*) @@ -8732,7 +9470,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='' + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + else + whole_archive_flag_spec='' + fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in @@ -8740,7 +9482,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=echo + output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" @@ -8783,7 +9525,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no @@ -8791,7 +9533,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hpux9*) if test "$GCC" = yes; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi @@ -8806,8 +9548,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi @@ -8825,16 +9567,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then + if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else @@ -8846,7 +9588,46 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler__b=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } + +if test x"$lt_cv_prog_compiler__b" = xyes; then + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + ;; esac fi @@ -8874,26 +9655,39 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -int foo(void) {} +int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" + LDFLAGS="$save_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test "$lt_cv_irix_exported_symbol" = yes; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' @@ -8955,17 +9749,17 @@ rm -f core conftest.err conftest.$ac_objext \ hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported - archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' @@ -8975,13 +9769,13 @@ rm -f core conftest.err conftest.$ac_objext \ osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -8994,9 +9788,9 @@ rm -f core conftest.err conftest.$ac_objext \ no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' - archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) @@ -9184,44 +9978,50 @@ x|xyes) # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - then - archive_cmds_need_lc=no - else - archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5 -$as_echo "$archive_cmds_need_lc" >&6; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi @@ -9392,16 +10192,23 @@ if test "$GCC" = yes; then darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` - else - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= @@ -9414,7 +10221,7 @@ if test "$GCC" = yes; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done - lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; @@ -9434,7 +10241,13 @@ BEGIN {RS=" "; FS="/|\n";} { if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` - sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([A-Za-z]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi @@ -9522,7 +10335,7 @@ amigaos*) m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; @@ -9553,8 +10366,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + case $GCC,$cc_basename in + yes,*) + # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ @@ -9575,36 +10389,83 @@ cygwin* | mingw* | pw32* | cegcc*) cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' ;; *) + # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' ;; esac - dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; @@ -9691,6 +10552,19 @@ gnu*) hardcode_into_libs=yes ;; +haiku*) + version_type=linux + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. @@ -9733,8 +10607,10 @@ hpux9* | hpux10* | hpux11*) soname_spec='${libname}${release}${shared_ext}$major' ;; esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 ;; interix[3-9]*) @@ -9792,7 +10668,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be Linux ELF. -linux* | k*bsd*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no @@ -9801,12 +10677,17 @@ linux* | k*bsd*-gnu) finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -9819,23 +10700,31 @@ main () _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - shlibpath_overrides_runpath=yes + lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -10137,6 +11026,11 @@ fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= @@ -10467,7 +11361,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10470 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10508,7 +11402,13 @@ else # endif #endif -void fnord() { int i=42;} +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -10517,7 +11417,11 @@ int main () if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } /* dlclose (self); */ } else @@ -10563,7 +11467,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10566 "configure" +#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10604,7 +11508,13 @@ else # endif #endif -void fnord() { int i=42;} +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -10613,7 +11523,11 @@ int main () if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } /* dlclose (self); */ } else @@ -10953,6 +11867,7 @@ $as_echo "no" >&6; } fi + # Extract the first word of "gtkdoc-check", so it can be a program name with args. set dummy gtkdoc-check; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -11110,6 +12025,99 @@ fi else as_fn_error $? "You need to have gtk-doc >= 1.10 installed to build $PACKAGE_NAME" "$LINENO" 5 fi + if test "x$PACKAGE_NAME" != "xglib"; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTKDOC_DEPS" >&5 +$as_echo_n "checking for GTKDOC_DEPS... " >&6; } + +if test -n "$GTKDOC_DEPS_CFLAGS"; then + pkg_cv_GTKDOC_DEPS_CFLAGS="$GTKDOC_DEPS_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GTKDOC_DEPS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GTKDOC_DEPS_LIBS"; then + pkg_cv_GTKDOC_DEPS_LIBS="$GTKDOC_DEPS_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GTKDOC_DEPS_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GTKDOC_DEPS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>&1` + else + GTKDOC_DEPS_PKG_ERRORS=`$PKG_CONFIG --print-errors "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GTKDOC_DEPS_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0) were not met: + +$GTKDOC_DEPS_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables GTKDOC_DEPS_CFLAGS +and GTKDOC_DEPS_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables GTKDOC_DEPS_CFLAGS +and GTKDOC_DEPS_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } + +else + GTKDOC_DEPS_CFLAGS=$pkg_cv_GTKDOC_DEPS_CFLAGS + GTKDOC_DEPS_LIBS=$pkg_cv_GTKDOC_DEPS_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build gtk-doc documentation" >&5 @@ -11399,8 +12407,7 @@ fi OLD_IFS=$IFS IFS=: -for i in $with_firmware_path -do +for i in $with_firmware_path; do if test "x${FIRMWARE_PATH}" = "x"; then FIRMWARE_PATH="\\\"${i}/\\\"" else @@ -11420,7 +12427,7 @@ else fi if test "x$with_systemdsystemunitdir" != xno; then - systemdsystemunitdir=$with_systemdsystemunitdir + systemdsystemunitdir=$with_systemdsystemunitdir fi if test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ; then @@ -11432,58 +12439,17 @@ else fi -# Check whether --enable-extras was given. -if test "${enable_extras+set}" = set; then : - enableval=$enable_extras; -else - enable_extras=yes -fi - -if test "x$enable_extras" = xyes; then - # Extract the first word of "gperf", so it can be a program name with args. -set dummy gperf; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_GPERF+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $GPERF in - [\\/]* | ?:[\\/]*) - ac_cv_path_GPERF="$GPERF" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_GPERF="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -GPERF=$ac_cv_path_GPERF -if test -n "$GPERF"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPERF" >&5 -$as_echo "$GPERF" >&6; } +# ------------------------------------------------------------------------------ +# GUdev - libudev gobject interface +# ------------------------------------------------------------------------------ +# Check whether --enable-gudev was given. +if test "${enable_gudev+set}" = set; then : + enableval=$enable_gudev; else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + enable_gudev=yes fi - - if test -z "$GPERF"; then - as_fn_error $? "gperf is needed" "$LINENO" 5 - fi - +if test "x$enable_gudev" = xyes; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB" >&5 @@ -11551,6 +12517,7 @@ installed software in a non-standard prefix. Alternatively, you may set the environment variables GLIB_CFLAGS and GLIB_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 + elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -11566,6 +12533,7 @@ See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } + else GLIB_CFLAGS=$pkg_cv_GLIB_CFLAGS GLIB_LIBS=$pkg_cv_GLIB_LIBS @@ -11573,91 +12541,47 @@ else $as_echo "yes" >&6; } fi +fi +# Check whether --enable-introspection was given. +if test "${enable_introspection+set}" = set; then : + enableval=$enable_introspection; +else + enable_introspection=yes +fi +if test "x$enable_introspection" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for acl_init in -lacl" >&5 -$as_echo_n "checking for acl_init in -lacl... " >&6; } -if ${ac_cv_lib_acl_acl_init+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lacl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for INTROSPECTION" >&5 +$as_echo_n "checking for INTROSPECTION... " >&6; } -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char acl_init (); -int -main () -{ -return acl_init (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_acl_acl_init=yes +if test -n "$INTROSPECTION_CFLAGS"; then + pkg_cv_INTROSPECTION_CFLAGS="$INTROSPECTION_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= 0.6.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= 0.6.2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags "gobject-introspection-1.0 >= 0.6.2" 2>/dev/null` else - ac_cv_lib_acl_acl_init=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_acl_acl_init" >&5 -$as_echo "$ac_cv_lib_acl_acl_init" >&6; } -if test "x$ac_cv_lib_acl_acl_init" = xyes; then : - : -else - as_fn_error $? "libacl not found" "$LINENO" 5 -fi - - ac_fn_c_check_header_mongrel "$LINENO" "acl/libacl.h" "ac_cv_header_acl_libacl_h" "$ac_includes_default" -if test "x$ac_cv_header_acl_libacl_h" = xyes; then : - : -else - as_fn_error $? "libacl header not found" "$LINENO" 5 -fi - - - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBUSB" >&5 -$as_echo_n "checking for LIBUSB... " >&6; } - -if test -n "$LIBUSB_CFLAGS"; then - pkg_cv_LIBUSB_CFLAGS="$LIBUSB_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb >= 0.1.12\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libusb >= 0.1.12") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_LIBUSB_CFLAGS=`$PKG_CONFIG --cflags "libusb >= 0.1.12" 2>/dev/null` -else - pkg_failed=yes + pkg_failed=yes fi else pkg_failed=untried fi -if test -n "$LIBUSB_LIBS"; then - pkg_cv_LIBUSB_LIBS="$LIBUSB_LIBS" +if test -n "$INTROSPECTION_LIBS"; then + pkg_cv_INTROSPECTION_LIBS="$INTROSPECTION_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb >= 0.1.12\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libusb >= 0.1.12") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= 0.6.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= 0.6.2") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_LIBUSB_LIBS=`$PKG_CONFIG --libs "libusb >= 0.1.12" 2>/dev/null` + pkg_cv_INTROSPECTION_LIBS=`$PKG_CONFIG --libs "gobject-introspection-1.0 >= 0.6.2" 2>/dev/null` else pkg_failed=yes fi @@ -11677,23 +12601,24 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - LIBUSB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libusb >= 0.1.12" 2>&1` + INTROSPECTION_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gobject-introspection-1.0 >= 0.6.2" 2>&1` else - LIBUSB_PKG_ERRORS=`$PKG_CONFIG --print-errors "libusb >= 0.1.12" 2>&1` + INTROSPECTION_PKG_ERRORS=`$PKG_CONFIG --print-errors "gobject-introspection-1.0 >= 0.6.2" 2>&1` fi # Put the nasty error message in config.log where it belongs - echo "$LIBUSB_PKG_ERRORS" >&5 + echo "$INTROSPECTION_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (libusb >= 0.1.12) were not met: + as_fn_error $? "Package requirements (gobject-introspection-1.0 >= 0.6.2) were not met: -$LIBUSB_PKG_ERRORS +$INTROSPECTION_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -Alternatively, you may set the environment variables LIBUSB_CFLAGS -and LIBUSB_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables INTROSPECTION_CFLAGS +and INTROSPECTION_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 + elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -11703,22 +12628,143 @@ as_fn_error $? "The pkg-config script could not be found or is too old. Make su is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. -Alternatively, you may set the environment variables LIBUSB_CFLAGS -and LIBUSB_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables INTROSPECTION_CFLAGS +and INTROSPECTION_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } + else - LIBUSB_CFLAGS=$pkg_cv_LIBUSB_CFLAGS - LIBUSB_LIBS=$pkg_cv_LIBUSB_LIBS + INTROSPECTION_CFLAGS=$pkg_cv_INTROSPECTION_CFLAGS + INTROSPECTION_LIBS=$pkg_cv_INTROSPECTION_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi +$as_echo "#define ENABLE_INTROSPECTION 1" >>confdefs.h + + G_IR_SCANNER=$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0) + + G_IR_COMPILER=$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0) + + G_IR_GENERATE=$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0) + + GIRDIR=$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0) + + GIRTYPELIBDIR=$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0) + +fi + if test "x$enable_introspection" = xyes; then + ENABLE_INTROSPECTION_TRUE= + ENABLE_INTROSPECTION_FALSE='#' +else + ENABLE_INTROSPECTION_TRUE='#' + ENABLE_INTROSPECTION_FALSE= +fi + + + if test "x$enable_gudev" = xyes; then + ENABLE_GUDEV_TRUE= + ENABLE_GUDEV_FALSE='#' +else + ENABLE_GUDEV_TRUE='#' + ENABLE_GUDEV_FALSE= +fi + + +# ------------------------------------------------------------------------------ +# usb/pci-db - read vendor/device string database +# ------------------------------------------------------------------------------ +# Check whether --enable-hwdb was given. +if test "${enable_hwdb+set}" = set; then : + enableval=$enable_hwdb; +else + enable_hwdb=yes +fi + +if test "x$enable_hwdb" = xyes; then + if test "x$cross_compiling" = "xno" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /usr/share/pci.ids" >&5 +$as_echo_n "checking for /usr/share/pci.ids... " >&6; } +if ${ac_cv_file__usr_share_pci_ids+:} false; then : + $as_echo_n "(cached) " >&6 +else + test "$cross_compiling" = yes && + as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 +if test -r "/usr/share/pci.ids"; then + ac_cv_file__usr_share_pci_ids=yes +else + ac_cv_file__usr_share_pci_ids=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__usr_share_pci_ids" >&5 +$as_echo "$ac_cv_file__usr_share_pci_ids" >&6; } +if test "x$ac_cv_file__usr_share_pci_ids" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE__USR_SHARE_PCI_IDS 1 +_ACEOF +pciids=/usr/share/pci.ids +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /usr/share/hwdata/pci.ids" >&5 +$as_echo_n "checking for /usr/share/hwdata/pci.ids... " >&6; } +if ${ac_cv_file__usr_share_hwdata_pci_ids+:} false; then : + $as_echo_n "(cached) " >&6 +else + test "$cross_compiling" = yes && + as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 +if test -r "/usr/share/hwdata/pci.ids"; then + ac_cv_file__usr_share_hwdata_pci_ids=yes +else + ac_cv_file__usr_share_hwdata_pci_ids=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__usr_share_hwdata_pci_ids" >&5 +$as_echo "$ac_cv_file__usr_share_hwdata_pci_ids" >&6; } +if test "x$ac_cv_file__usr_share_hwdata_pci_ids" = xyes; then : +cat >>confdefs.h <<_ACEOF +#define HAVE__USR_SHARE_HWDATA_PCI_IDS 1 +_ACEOF +pciids=/usr/share/hwdata/pci.ids +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /usr/share/misc/pci.ids" >&5 +$as_echo_n "checking for /usr/share/misc/pci.ids... " >&6; } +if ${ac_cv_file__usr_share_misc_pci_ids+:} false; then : + $as_echo_n "(cached) " >&6 +else + test "$cross_compiling" = yes && + as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 +if test -r "/usr/share/misc/pci.ids"; then + ac_cv_file__usr_share_misc_pci_ids=yes +else + ac_cv_file__usr_share_misc_pci_ids=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__usr_share_misc_pci_ids" >&5 +$as_echo "$ac_cv_file__usr_share_misc_pci_ids" >&6; } +if test "x$ac_cv_file__usr_share_misc_pci_ids" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE__USR_SHARE_MISC_PCI_IDS 1 +_ACEOF +pciids=/usr/share/misc/pci.ids +fi + + fi + + +# Check whether --with-usb-ids-path was given. +if test "${with_usb_ids_path+set}" = set; then : + withval=$with_usb_ids_path; USB_DATABASE=${withval} +else + if test -n "$usbids" ; then + USB_DATABASE="$usbids" + else pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for USBUTILS" >&5 @@ -11786,6 +12832,7 @@ installed software in a non-standard prefix. Alternatively, you may set the environment variables USBUTILS_CFLAGS and USBUTILS_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 + elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -11801,6 +12848,7 @@ See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } + else USBUTILS_CFLAGS=$pkg_cv_USBUTILS_CFLAGS USBUTILS_LIBS=$pkg_cv_USBUTILS_LIBS @@ -11808,80 +12856,17 @@ else $as_echo "yes" >&6; } fi - USB_DATABASE=$($PKG_CONFIG --variable=usbids usbutils) - + USB_DATABASE=$($PKG_CONFIG --variable=usbids usbutils) - if test "x$cross_compiling" = "xno" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /usr/share/pci.ids" >&5 -$as_echo_n "checking for /usr/share/pci.ids... " >&6; } -if ${ac_cv_file__usr_share_pci_ids+:} false; then : - $as_echo_n "(cached) " >&6 -else - test "$cross_compiling" = yes && - as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 -if test -r "/usr/share/pci.ids"; then - ac_cv_file__usr_share_pci_ids=yes -else - ac_cv_file__usr_share_pci_ids=no -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__usr_share_pci_ids" >&5 -$as_echo "$ac_cv_file__usr_share_pci_ids" >&6; } -if test "x$ac_cv_file__usr_share_pci_ids" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE__USR_SHARE_PCI_IDS 1 -_ACEOF -pciids=/usr/share/pci.ids + fi fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /usr/share/hwdata/pci.ids" >&5 -$as_echo_n "checking for /usr/share/hwdata/pci.ids... " >&6; } -if ${ac_cv_file__usr_share_hwdata_pci_ids+:} false; then : - $as_echo_n "(cached) " >&6 -else - test "$cross_compiling" = yes && - as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 -if test -r "/usr/share/hwdata/pci.ids"; then - ac_cv_file__usr_share_hwdata_pci_ids=yes -else - ac_cv_file__usr_share_hwdata_pci_ids=no -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__usr_share_hwdata_pci_ids" >&5 -$as_echo "$ac_cv_file__usr_share_hwdata_pci_ids" >&6; } -if test "x$ac_cv_file__usr_share_hwdata_pci_ids" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for USB database location" >&5 +$as_echo_n "checking for USB database location... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USB_DATABASE" >&5 +$as_echo "$USB_DATABASE" >&6; } -cat >>confdefs.h <<_ACEOF -#define HAVE__USR_SHARE_HWDATA_PCI_IDS 1 -_ACEOF -pciids=/usr/share/hwdata/pci.ids -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /usr/share/misc/pci.ids" >&5 -$as_echo_n "checking for /usr/share/misc/pci.ids... " >&6; } -if ${ac_cv_file__usr_share_misc_pci_ids+:} false; then : - $as_echo_n "(cached) " >&6 -else - test "$cross_compiling" = yes && - as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 -if test -r "/usr/share/misc/pci.ids"; then - ac_cv_file__usr_share_misc_pci_ids=yes -else - ac_cv_file__usr_share_misc_pci_ids=no -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__usr_share_misc_pci_ids" >&5 -$as_echo "$ac_cv_file__usr_share_misc_pci_ids" >&6; } -if test "x$ac_cv_file__usr_share_misc_pci_ids" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE__USR_SHARE_MISC_PCI_IDS 1 -_ACEOF -pciids=/usr/share/misc/pci.ids -fi - - fi # Check whether --with-pci-ids-path was given. if test "${with_pci_ids_path+set}" = set; then : @@ -11899,6 +12884,70 @@ $as_echo_n "checking for PCI database location... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PCI_DATABASE" >&5 $as_echo "$PCI_DATABASE" >&6; } +fi + if test "x$enable_hwdb" = xyes; then + ENABLE_HWDB_TRUE= + ENABLE_HWDB_FALSE='#' +else + ENABLE_HWDB_TRUE='#' + ENABLE_HWDB_FALSE= +fi + + +# ------------------------------------------------------------------------------ +# keymap - map custom hardware's multimedia keys +# ------------------------------------------------------------------------------ +# Check whether --enable-keymap was given. +if test "${enable_keymap+set}" = set; then : + enableval=$enable_keymap; +else + enable_keymap=yes +fi + +if test "x$enable_keymap" = xyes; then + # Extract the first word of "gperf", so it can be a program name with args. +set dummy gperf; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GPERF+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GPERF in + [\\/]* | ?:[\\/]*) + ac_cv_path_GPERF="$GPERF" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GPERF="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +GPERF=$ac_cv_path_GPERF +if test -n "$GPERF"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPERF" >&5 +$as_echo "$GPERF" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test -z "$GPERF"; then + as_fn_error $? "gperf is needed" "$LINENO" 5 + fi ac_fn_c_check_header_mongrel "$LINENO" "linux/input.h" "ac_cv_header_linux_input_h" "$ac_includes_default" if test "x$ac_cv_header_linux_input_h" = xyes; then : @@ -11911,54 +12960,146 @@ fi INCLUDE_PREFIX=$(echo '#include ' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}') fi - if test "x$enable_extras" = xyes; then - ENABLE_EXTRAS_TRUE= - ENABLE_EXTRAS_FALSE='#' + if test "x$enable_keymap" = xyes; then + ENABLE_KEYMAP_TRUE= + ENABLE_KEYMAP_FALSE='#' else - ENABLE_EXTRAS_TRUE='#' - ENABLE_EXTRAS_FALSE= + ENABLE_KEYMAP_TRUE='#' + ENABLE_KEYMAP_FALSE= fi -# Check whether --enable-introspection was given. -if test "${enable_introspection+set}" = set; then : - enableval=$enable_introspection; +# ------------------------------------------------------------------------------ +# mtd_probe - autoloads FTL module for mtd devices +# ------------------------------------------------------------------------------ +# Check whether --enable-mtd_probe was given. +if test "${enable_mtd_probe+set}" = set; then : + enableval=$enable_mtd_probe; else - enable_introspection=yes + enable_mtd_probe=yes fi -if test "x$enable_introspection" = xyes; then + if test "x$enable_mtd_probe" = xyes; then + ENABLE_MTD_PROBE_TRUE= + ENABLE_MTD_PROBE_FALSE='#' +else + ENABLE_MTD_PROBE_TRUE='#' + ENABLE_MTD_PROBE_FALSE= +fi -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for INTROSPECTION" >&5 -$as_echo_n "checking for INTROSPECTION... " >&6; } -if test -n "$INTROSPECTION_CFLAGS"; then - pkg_cv_INTROSPECTION_CFLAGS="$INTROSPECTION_CFLAGS" +# ------------------------------------------------------------------------------ +# rule_generator - persistent network and optical device rule generator +# ------------------------------------------------------------------------------ +# Check whether --enable-rule_generator was given. +if test "${enable_rule_generator+set}" = set; then : + enableval=$enable_rule_generator; +else + enable_rule_generator=no +fi + + if test "x$enable_rule_generator" = xyes; then + ENABLE_RULE_GENERATOR_TRUE= + ENABLE_RULE_GENERATOR_FALSE='#' +else + ENABLE_RULE_GENERATOR_TRUE='#' + ENABLE_RULE_GENERATOR_FALSE= +fi + + +# ------------------------------------------------------------------------------ +# udev_acl - apply ACLs for users with local forground sessions +# ------------------------------------------------------------------------------ +# Check whether --enable-udev_acl was given. +if test "${enable_udev_acl+set}" = set; then : + enableval=$enable_udev_acl; +else + enable_udev_acl=no +fi + +if test "x$enable_udev_acl" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for acl_init in -lacl" >&5 +$as_echo_n "checking for acl_init in -lacl... " >&6; } +if ${ac_cv_lib_acl_acl_init+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lacl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char acl_init (); +int +main () +{ +return acl_init (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_acl_acl_init=yes +else + ac_cv_lib_acl_acl_init=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_acl_acl_init" >&5 +$as_echo "$ac_cv_lib_acl_acl_init" >&6; } +if test "x$ac_cv_lib_acl_acl_init" = xyes; then : + : +else + as_fn_error $? "libacl not found" "$LINENO" 5 +fi + + ac_fn_c_check_header_mongrel "$LINENO" "acl/libacl.h" "ac_cv_header_acl_libacl_h" "$ac_includes_default" +if test "x$ac_cv_header_acl_libacl_h" = xyes; then : + : +else + as_fn_error $? "libacl header not found" "$LINENO" 5 +fi + + + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB" >&5 +$as_echo_n "checking for GLIB... " >&6; } + +if test -n "$GLIB_CFLAGS"; then + pkg_cv_GLIB_CFLAGS="$GLIB_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= 0.6.2\""; } >&5 - ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= 0.6.2") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags "gobject-introspection-1.0 >= 0.6.2" 2>/dev/null` + pkg_cv_GLIB_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi -if test -n "$INTROSPECTION_LIBS"; then - pkg_cv_INTROSPECTION_LIBS="$INTROSPECTION_LIBS" +if test -n "$GLIB_LIBS"; then + pkg_cv_GLIB_LIBS="$GLIB_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= 0.6.2\""; } >&5 - ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= 0.6.2") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_INTROSPECTION_LIBS=`$PKG_CONFIG --libs "gobject-introspection-1.0 >= 0.6.2" 2>/dev/null` + pkg_cv_GLIB_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0" 2>/dev/null` else pkg_failed=yes fi @@ -11978,23 +13119,24 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - INTROSPECTION_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gobject-introspection-1.0 >= 0.6.2" 2>&1` + GLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0" 2>&1` else - INTROSPECTION_PKG_ERRORS=`$PKG_CONFIG --print-errors "gobject-introspection-1.0 >= 0.6.2" 2>&1` + GLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors "glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0" 2>&1` fi # Put the nasty error message in config.log where it belongs - echo "$INTROSPECTION_PKG_ERRORS" >&5 + echo "$GLIB_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (gobject-introspection-1.0 >= 0.6.2) were not met: + as_fn_error $? "Package requirements (glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0) were not met: -$INTROSPECTION_PKG_ERRORS +$GLIB_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -Alternatively, you may set the environment variables INTROSPECTION_CFLAGS -and INTROSPECTION_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables GLIB_CFLAGS +and GLIB_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 + elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -12004,45 +13146,71 @@ as_fn_error $? "The pkg-config script could not be found or is too old. Make su is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. -Alternatively, you may set the environment variables INTROSPECTION_CFLAGS -and INTROSPECTION_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables GLIB_CFLAGS +and GLIB_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } + else - INTROSPECTION_CFLAGS=$pkg_cv_INTROSPECTION_CFLAGS - INTROSPECTION_LIBS=$pkg_cv_INTROSPECTION_LIBS + GLIB_CFLAGS=$pkg_cv_GLIB_CFLAGS + GLIB_LIBS=$pkg_cv_GLIB_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi +fi + if test "x$enable_udev_acl" = xyes; then + ENABLE_UDEV_ACL_TRUE= + ENABLE_UDEV_ACL_FALSE='#' +else + ENABLE_UDEV_ACL_TRUE='#' + ENABLE_UDEV_ACL_FALSE= +fi -$as_echo "#define ENABLE_INTROSPECTION 1" >>confdefs.h - - G_IR_SCANNER=$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0) - - G_IR_COMPILER=$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0) - G_IR_GENERATE=$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0) +# ------------------------------------------------------------------------------ +# create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) +# ------------------------------------------------------------------------------ +# Check whether --enable-floppy was given. +if test "${enable_floppy+set}" = set; then : + enableval=$enable_floppy; +else + enable_floppy=no +fi - GIRDIR=$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0) + if test "x$enable_floppy" = xyes; then + ENABLE_FLOPPY_TRUE= + ENABLE_FLOPPY_FALSE='#' +else + ENABLE_FLOPPY_TRUE='#' + ENABLE_FLOPPY_FALSE= +fi - GIRTYPELIBDIR=$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0) +# ------------------------------------------------------------------------------ +# edd_id - create /dev/disk/by-id/edd-* links for BIOS EDD data +# ------------------------------------------------------------------------------ +# Check whether --enable-edd was given. +if test "${enable_edd+set}" = set; then : + enableval=$enable_edd; +else + enable_edd=no fi - if test "x$enable_introspection" = xyes; then - ENABLE_INTROSPECTION_TRUE= - ENABLE_INTROSPECTION_FALSE='#' + + if test "x$enable_edd" = xyes; then + ENABLE_EDD_TRUE= + ENABLE_EDD_FALSE='#' else - ENABLE_INTROSPECTION_TRUE='#' - ENABLE_INTROSPECTION_FALSE= + ENABLE_EDD_TRUE='#' + ENABLE_EDD_FALSE= fi ac_config_headers="$ac_config_headers config.h" -ac_config_files="$ac_config_files Makefile udev/udev.pc init/udev.service init/udev-settle.service init/udev-retry.service libudev/libudev.pc libudev/docs/Makefile libudev/docs/version.xml extras/gudev/gudev-1.0.pc extras/gudev/docs/Makefile extras/gudev/docs/version.xml" +ac_config_files="$ac_config_files Makefile udev/udev.pc init/udev.service init/udev-trigger.service init/udev-settle.service libudev/libudev.pc libudev/docs/Makefile libudev/docs/version.xml extras/gudev/gudev-1.0.pc extras/gudev/docs/Makefile extras/gudev/docs/version.xml" cat >confcache <<\_ACEOF @@ -12198,14 +13366,42 @@ if test -z "${WITH_SYSTEMD_TRUE}" && test -z "${WITH_SYSTEMD_FALSE}"; then as_fn_error $? "conditional \"WITH_SYSTEMD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${ENABLE_EXTRAS_TRUE}" && test -z "${ENABLE_EXTRAS_FALSE}"; then - as_fn_error $? "conditional \"ENABLE_EXTRAS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${ENABLE_INTROSPECTION_TRUE}" && test -z "${ENABLE_INTROSPECTION_FALSE}"; then as_fn_error $? "conditional \"ENABLE_INTROSPECTION\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_GUDEV_TRUE}" && test -z "${ENABLE_GUDEV_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_GUDEV\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_HWDB_TRUE}" && test -z "${ENABLE_HWDB_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_HWDB\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_KEYMAP_TRUE}" && test -z "${ENABLE_KEYMAP_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_KEYMAP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_MTD_PROBE_TRUE}" && test -z "${ENABLE_MTD_PROBE_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_MTD_PROBE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_RULE_GENERATOR_TRUE}" && test -z "${ENABLE_RULE_GENERATOR_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_RULE_GENERATOR\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_UDEV_ACL_TRUE}" && test -z "${ENABLE_UDEV_ACL_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_UDEV_ACL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_FLOPPY_TRUE}" && test -z "${ENABLE_FLOPPY_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_FLOPPY\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_EDD_TRUE}" && test -z "${ENABLE_EDD_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_EDD\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 @@ -12615,7 +13811,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by udev $as_me 166, which was +This file was extended by udev $as_me 174, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12675,13 +13871,14 @@ $config_headers Configuration commands: $config_commands -Report bugs to ." +Report bugs to . +udev home page: ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -udev config.status 166 +udev config.status 174 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" @@ -12810,131 +14007,153 @@ AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' -enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' -macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' -macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' -enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' -pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' -enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' -host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' -host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' -host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' -build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' -build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' -build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' -SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' -Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' -GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' -EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' -FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' -LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' -NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' -LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' -max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' -ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' -exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' -lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' -lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' -lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' -reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' -reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' -OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' -deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' -file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' -AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' -AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' -STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' -RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' -old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' -CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' -CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' -compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' -GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' -objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' -SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' -ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' -MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' -need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' -DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' -NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' -LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' -OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' -OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' -libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' -shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' -extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' -export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' -module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' -module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' -with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' -allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' -no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' -inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' -link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' -fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' -always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' -export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' -exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' -include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' -prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' -file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' -variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' -need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' -need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' -version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' -runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' -shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' -shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' -libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' -library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' -soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' -postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' -finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' -sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' -sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' -old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' -striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + # Quote evaled strings. -for var in SED \ +for var in SHELL \ +ECHO \ +SED \ GREP \ EGREP \ FGREP \ @@ -12947,8 +14166,13 @@ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +DLLTOOL \ +sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ +archiver_list_spec \ STRIP \ RANLIB \ CC \ @@ -12958,14 +14182,14 @@ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -SHELL \ -ECHO \ +nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ -lt_prog_compiler_wl \ lt_prog_compiler_pic \ +lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ +MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ @@ -12981,7 +14205,6 @@ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ -fix_srcfile_path \ exclude_expsyms \ include_expsyms \ file_list_spec \ @@ -12989,12 +14212,13 @@ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ +install_override_mode \ finish_eval \ old_striplib \ striplib; do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -13016,14 +14240,15 @@ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ +postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -13031,12 +14256,6 @@ sys_lib_dlsearch_path_spec; do esac done -# Fix-up fallback echo if it was mangled by the above quoting rules. -case \$lt_ECHO in -*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` - ;; -esac - ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' @@ -13071,8 +14290,8 @@ do "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "udev/udev.pc") CONFIG_FILES="$CONFIG_FILES udev/udev.pc" ;; "init/udev.service") CONFIG_FILES="$CONFIG_FILES init/udev.service" ;; + "init/udev-trigger.service") CONFIG_FILES="$CONFIG_FILES init/udev-trigger.service" ;; "init/udev-settle.service") CONFIG_FILES="$CONFIG_FILES init/udev-settle.service" ;; - "init/udev-retry.service") CONFIG_FILES="$CONFIG_FILES init/udev-retry.service" ;; "libudev/libudev.pc") CONFIG_FILES="$CONFIG_FILES libudev/libudev.pc" ;; "libudev/docs/Makefile") CONFIG_FILES="$CONFIG_FILES libudev/docs/Makefile" ;; "libudev/docs/version.xml") CONFIG_FILES="$CONFIG_FILES libudev/docs/version.xml" ;; @@ -13786,10 +15005,12 @@ $as_echo X"$file" | # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. +# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, +# Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. @@ -13837,6 +15058,12 @@ pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + # The host system. host_alias=$host_alias host=$host @@ -13886,9 +15113,11 @@ SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP @@ -13896,13 +15125,30 @@ OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method -# Command to use when deplibs_check_method == "file_magic". +# Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + # The archiver. AR=$lt_AR + +# Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + # A symbol stripping program. STRIP=$lt_STRIP @@ -13911,6 +15157,9 @@ RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + # A C compiler. LTCC=$lt_CC @@ -13929,14 +15178,14 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix -# The name of the directory that contains temporary libtool files. -objdir=$objdir +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL +# The root where to search for dependent libraries,and in which our libraries should be installed. +lt_sysroot=$lt_sysroot -# An echo program that does not interpret backslashes. -ECHO=$lt_ECHO +# The name of the directory that contains temporary libtool files. +objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD @@ -13944,6 +15193,9 @@ MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL @@ -14000,6 +15252,9 @@ library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds @@ -14039,6 +15294,10 @@ striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds @@ -14051,12 +15310,12 @@ with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static @@ -14143,9 +15402,6 @@ inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path=$lt_fix_srcfile_path - # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols @@ -14161,6 +15417,9 @@ include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + # Specify filename containing input files. file_list_spec=$lt_file_list_spec @@ -14193,212 +15452,169 @@ ltmain="$ac_aux_dir/ltmain.sh" # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? - sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - case $xsi_shell in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=${1%%=*} - func_opt_split_arg=${1#*=} -} - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $* )) -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} - -_LT_EOF - ;; - *) # Bourne compatible functions. - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` -} - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; - esac -} - -# sed scripts: -my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' -my_sed_long_arg='1s/^-[^=]*=//' - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` -} - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "$@"` -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` -} - -_LT_EOF -esac - -case $lt_shell_append in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$1+=\$2" -} -_LT_EOF - ;; - *) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$1=\$$1\$2" -} - -_LT_EOF - ;; - esac - - - sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + if test x"$xsi_shell" = xyes; then + sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ +func_dirname ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_basename ()$/,/^} # func_basename /c\ +func_basename ()\ +{\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ +func_dirname_and_basename ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ +func_stripname ()\ +{\ +\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ +\ # positional parameters, so assign one to ordinary parameter first.\ +\ func_stripname_result=${3}\ +\ func_stripname_result=${func_stripname_result#"${1}"}\ +\ func_stripname_result=${func_stripname_result%"${2}"}\ +} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ +func_split_long_opt ()\ +{\ +\ func_split_long_opt_name=${1%%=*}\ +\ func_split_long_opt_arg=${1#*=}\ +} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ +func_split_short_opt ()\ +{\ +\ func_split_short_opt_arg=${1#??}\ +\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ +} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ +func_lo2o ()\ +{\ +\ case ${1} in\ +\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ +\ *) func_lo2o_result=${1} ;;\ +\ esac\ +} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_xform ()$/,/^} # func_xform /c\ +func_xform ()\ +{\ + func_xform_result=${1%.*}.lo\ +} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_arith ()$/,/^} # func_arith /c\ +func_arith ()\ +{\ + func_arith_result=$(( $* ))\ +} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_len ()$/,/^} # func_len /c\ +func_len ()\ +{\ + func_len_result=${#1}\ +} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + +fi + +if test x"$lt_shell_append" = xyes; then + sed -e '/^func_append ()$/,/^} # func_append /c\ +func_append ()\ +{\ + eval "${1}+=\\${2}"\ +} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ +func_append_quoted ()\ +{\ +\ func_quote_for_eval "${2}"\ +\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ +} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 +$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} +fi + + + mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" @@ -14451,32 +15667,34 @@ fi libdir: ${libdir} rootlibdir: ${rootlib_execdir} libexecdir: ${libexecdir} - datarootdir: ${datarootdir} mandir: ${mandir} includedir: ${includedir} - include_prefix: ${INCLUDE_PREFIX} - systemdsystemunitdir: ${systemdsystemunitdir} - - logging: ${enable_logging} - debug: ${enable_debug} - selinux: ${with_selinux} + firmware path: ${FIRMWARE_PATH} compiler: ${CC} cflags: ${CFLAGS} ldflags: ${LDFLAGS} - - extras: ${enable_extras} - gintrospection: ${enable_introspection} - - usb.ids: ${USB_DATABASE} - pci.ids: ${PCI_DATABASE} - firmware path: ${FIRMWARE_PATH} - xsltproc: ${XSLTPROC} gperf: ${GPERF} + + logging: ${enable_logging} + debug: ${enable_debug} + selinux: ${with_selinux} + + gudev: ${enable_gudev} + gintrospection: ${enable_introspection} + keymap: ${enable_keymap} + hwdb: ${enable_hwdb} + usb.ids: ${USB_DATABASE} + pci.ids: ${PCI_DATABASE} + mtd_probe: ${enable_mtd_probe} + rule_generator: ${enable_rule_generator} + udev_acl: ${enable_udev_acl} + floppy: ${enable_floppy} + edd: ${enable_edd} " >&5 $as_echo " udev $VERSION @@ -14488,30 +15706,32 @@ $as_echo " libdir: ${libdir} rootlibdir: ${rootlib_execdir} libexecdir: ${libexecdir} - datarootdir: ${datarootdir} mandir: ${mandir} includedir: ${includedir} - include_prefix: ${INCLUDE_PREFIX} - systemdsystemunitdir: ${systemdsystemunitdir} - - logging: ${enable_logging} - debug: ${enable_debug} - selinux: ${with_selinux} + firmware path: ${FIRMWARE_PATH} compiler: ${CC} cflags: ${CFLAGS} ldflags: ${LDFLAGS} - - extras: ${enable_extras} - gintrospection: ${enable_introspection} - - usb.ids: ${USB_DATABASE} - pci.ids: ${PCI_DATABASE} - firmware path: ${FIRMWARE_PATH} - xsltproc: ${XSLTPROC} gperf: ${GPERF} + + logging: ${enable_logging} + debug: ${enable_debug} + selinux: ${with_selinux} + + gudev: ${enable_gudev} + gintrospection: ${enable_introspection} + keymap: ${enable_keymap} + hwdb: ${enable_hwdb} + usb.ids: ${USB_DATABASE} + pci.ids: ${PCI_DATABASE} + mtd_probe: ${enable_mtd_probe} + rule_generator: ${enable_rule_generator} + udev_acl: ${enable_udev_acl} + floppy: ${enable_floppy} + edd: ${enable_edd} " >&6; } diff --git a/configure.ac b/configure.ac index 9d35cfc..a12c014 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,17 @@ -AC_INIT([udev], [166], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) -AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +AC_INIT([udev], + [174], + [linux-hotplug@vger.kernel.org], + [udev], + [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) +AC_CONFIG_SRCDIR([udev/udevd.c]) +AC_CONFIG_AUX_DIR([build-aux]) +AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax dist-bzip2 subdir-objects]) AC_DISABLE_STATIC AC_USE_SYSTEM_EXTENSIONS AC_SYS_LARGEFILE AC_CONFIG_MACRO_DIR([m4]) +AM_SILENT_RULES([yes]) LT_INIT AC_PROG_AWK GTK_DOC_CHECK(1.10) @@ -54,8 +60,7 @@ AC_ARG_WITH(firmware-path, [], [with_firmware_path="/lib/firmware/updates:/lib/firmware"]) OLD_IFS=$IFS IFS=: -for i in $with_firmware_path -do +for i in $with_firmware_path; do if test "x${FIRMWARE_PATH}" = "x"; then FIRMWARE_PATH="\\\"${i}/\\\"" else @@ -69,38 +74,62 @@ AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) if test "x$with_systemdsystemunitdir" != xno; then - AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) + AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) fi AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) -AC_ARG_ENABLE([extras], - AS_HELP_STRING([--disable-extras], [disable extras with external dependencies]), - [], [enable_extras=yes]) -if test "x$enable_extras" = xyes; then - AC_PATH_PROG([GPERF], [gperf]) - if test -z "$GPERF"; then - AC_MSG_ERROR([gperf is needed]) - fi - +# ------------------------------------------------------------------------------ +# GUdev - libudev gobject interface +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([gudev], + AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support]), + [], [enable_gudev=yes]) +if test "x$enable_gudev" = xyes; then PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) - AC_SUBST([GLIB_CFLAGS]) - AC_SUBST([GLIB_LIBS]) - - AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found])) - AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found])) +fi - PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.12) - AC_SUBST(LIBUSB_CFLAGS) - AC_SUBST(LIBUSB_LIBS) +AC_ARG_ENABLE([introspection], + AS_HELP_STRING([--disable-introspection], [disable GObject introspection]), + [], [enable_introspection=yes]) +if test "x$enable_introspection" = xyes; then + PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2]) + AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support]) + AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)]) + AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)]) + AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)]) + AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0)]) + AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0)]) +fi +AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = xyes]) - PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82) - AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)]) +AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = xyes]) +# ------------------------------------------------------------------------------ +# usb/pci-db - read vendor/device string database +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([hwdb], + AS_HELP_STRING([--disable-hwdb], [disable hardware database support]), + [], [enable_hwdb=yes]) +if test "x$enable_hwdb" = xyes; then if test "x$cross_compiling" = "xno" ; then AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids]) AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids]) AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids]) fi + + AC_ARG_WITH(usb-ids-path, + [AS_HELP_STRING([--with-usb-ids-path=DIR], [Path to usb.ids file])], + [USB_DATABASE=${withval}], + [if test -n "$usbids" ; then + USB_DATABASE="$usbids" + else + PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82) + AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)]) + fi]) + AC_MSG_CHECKING([for USB database location]) + AC_MSG_RESULT([$USB_DATABASE]) + AC_SUBST(USB_DATABASE) + AC_ARG_WITH(pci-ids-path, [AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file])], [PCI_DATABASE=${withval}], @@ -112,33 +141,79 @@ if test "x$enable_extras" = xyes; then AC_MSG_CHECKING([for PCI database location]) AC_MSG_RESULT([$PCI_DATABASE]) AC_SUBST(PCI_DATABASE) +fi +AM_CONDITIONAL([ENABLE_HWDB], [test "x$enable_hwdb" = xyes]) + +# ------------------------------------------------------------------------------ +# keymap - map custom hardware's multimedia keys +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([keymap], + AS_HELP_STRING([--disable-keymap], [disable keymap fixup support]), + [], [enable_keymap=yes]) +if test "x$enable_keymap" = xyes; then + AC_PATH_PROG([GPERF], [gperf]) + if test -z "$GPERF"; then + AC_MSG_ERROR([gperf is needed]) + fi AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found])) AC_SUBST([INCLUDE_PREFIX], [$(echo '#include ' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')]) fi -AM_CONDITIONAL([ENABLE_EXTRAS], [test "x$enable_extras" = xyes]) +AM_CONDITIONAL([ENABLE_KEYMAP], [test "x$enable_keymap" = xyes]) -AC_ARG_ENABLE([introspection], - AS_HELP_STRING([--disable-introspection], [disable GObject introspection]), - [], [enable_introspection=yes]) -if test "x$enable_introspection" = xyes; then - PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2]) - AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support]) - AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)]) - AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)]) - AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)]) - AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0)]) - AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0)]) +# ------------------------------------------------------------------------------ +# mtd_probe - autoloads FTL module for mtd devices +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([mtd_probe], + AS_HELP_STRING([--disable-mtd_probe], [disable MTD support]), + [], [enable_mtd_probe=yes]) +AM_CONDITIONAL([ENABLE_MTD_PROBE], [test "x$enable_mtd_probe" = xyes]) + +# ------------------------------------------------------------------------------ +# rule_generator - persistent network and optical device rule generator +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([rule_generator], + AS_HELP_STRING([--enable-rule_generator], [enable persistent network + cdrom links support]), + [], [enable_rule_generator=no]) +AM_CONDITIONAL([ENABLE_RULE_GENERATOR], [test "x$enable_rule_generator" = xyes]) + +# ------------------------------------------------------------------------------ +# udev_acl - apply ACLs for users with local forground sessions +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([udev_acl], + AS_HELP_STRING([--enable-udev_acl], [enable local user acl permissions support]), + [], [enable_udev_acl=no]) +if test "x$enable_udev_acl" = xyes; then + AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found])) + AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found])) + + PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) fi -AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = xyes]) +AM_CONDITIONAL([ENABLE_UDEV_ACL], [test "x$enable_udev_acl" = xyes]) + +# ------------------------------------------------------------------------------ +# create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([floppy], + AS_HELP_STRING([--enable-floppy], [enable legacy floppy support]), + [], [enable_floppy=no]) +AM_CONDITIONAL([ENABLE_FLOPPY], [test "x$enable_floppy" = xyes]) + +# ------------------------------------------------------------------------------ +# edd_id - create /dev/disk/by-id/edd-* links for BIOS EDD data +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([edd], + AS_HELP_STRING([--enable-edd], [enable disk edd support]), + [], [enable_edd=no]) +AM_CONDITIONAL([ENABLE_EDD], [test "x$enable_edd" = xyes]) AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ Makefile udev/udev.pc init/udev.service + init/udev-trigger.service init/udev-settle.service - init/udev-retry.service libudev/libudev.pc libudev/docs/Makefile libudev/docs/version.xml @@ -158,30 +233,32 @@ AC_MSG_RESULT([ libdir: ${libdir} rootlibdir: ${rootlib_execdir} libexecdir: ${libexecdir} - datarootdir: ${datarootdir} mandir: ${mandir} includedir: ${includedir} - include_prefix: ${INCLUDE_PREFIX} - systemdsystemunitdir: ${systemdsystemunitdir} - - logging: ${enable_logging} - debug: ${enable_debug} - selinux: ${with_selinux} + firmware path: ${FIRMWARE_PATH} compiler: ${CC} cflags: ${CFLAGS} ldflags: ${LDFLAGS} - - extras: ${enable_extras} - gintrospection: ${enable_introspection} - - usb.ids: ${USB_DATABASE} - pci.ids: ${PCI_DATABASE} - firmware path: ${FIRMWARE_PATH} - xsltproc: ${XSLTPROC} gperf: ${GPERF} + + logging: ${enable_logging} + debug: ${enable_debug} + selinux: ${with_selinux} + + gudev: ${enable_gudev} + gintrospection: ${enable_introspection} + keymap: ${enable_keymap} + hwdb: ${enable_hwdb} + usb.ids: ${USB_DATABASE} + pci.ids: ${PCI_DATABASE} + mtd_probe: ${enable_mtd_probe} + rule_generator: ${enable_rule_generator} + udev_acl: ${enable_udev_acl} + floppy: ${enable_floppy} + edd: ${enable_edd} ]) diff --git a/debian/changelog b/debian/changelog index 6f4d059..900339d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,27 @@ +udev (174-1slp2+s1) unstable; urgency=low + + * udev version update(v.166->174) + * Git: slp/pkgs/u/udev + * Tag: udev_174-1slp2+s1 + + -- Jooseok Park Wed, 20 Jun 2012 17:29:28 +0900 + +udev (166-1slp2+s12) unstable; urgency=low + + * Modify Makefile.am to remove 75-persistent-net-generator.rules + * Git: slp/pkgs/u/udev + * Tag: udev_166-1slp2+s12 + + -- Kyuwook Lim Fri, 13 Apr 2012 19:58:28 +0900 + +udev (166-1slp2+s11) unstable; urgency=low + + * Delete rules/debian/75-persistent-net-generator.rules for wifi interface issue + * Git: slp/pkgs/u/udev + * Tag: udev_166-1slp2+s11 + + -- Kyuwook Lim Thu, 12 Apr 2012 14:09:38 +0900 + udev (166-1slp2+s10) unstable; urgency=low [ Kim Hyunhee ] diff --git a/debian/control b/debian/control index 420b5f6..c30c64a 100644 --- a/debian/control +++ b/debian/control @@ -1,8 +1,8 @@ Source: udev Section: admin Priority: important -Maintainer: Hyunhee Kim -Uploaders: Hyunhee Kim , Rafal Krypa +Maintainer: WaLyong Cho , Jooseok Park +Uploaders: WaLyong Cho , Jooseok Park , Rafal Krypa X-Original-Maintainer: Marco d'Itri Build-Depends: debhelper (>> 7), hardening-includes, quilt (>= 0.40), libglib2.0-dev (>= 2.12.0), libusb-dev (>= 1:0.1.12), libacl1-dev, usbutils (>= 0.86-2), pciutils, libc6-dev (>= 2.9) [!alpha !ia64], libc6.1-dev (>= 2.9) [alpha ia64], linux-libc-dev (>= 2.6.29), autoconf, automake, libtool (>= 2.2.2), gtk-doc-tools, xsltproc, docbook-xsl, gperf Standards-Version: 3.9.1 diff --git a/extra/blacklist.conf b/extra/blacklist.conf deleted file mode 100644 index 316d7e4..0000000 --- a/extra/blacklist.conf +++ /dev/null @@ -1,24 +0,0 @@ -# This file lists modules which will not be loaded as the result of -# alias expansion, with the purpose of preventing the hotplug subsystem -# to load them. It does not affect autoloading of modules by the kernel. -# This file is provided by the udev package. - -# evbug is a debug tool and should be loaded explicitly -blacklist evbug - -# these drivers are very simple, the HID drivers are usually preferred -blacklist usbmouse -blacklist usbkbd - -# replaced by e100 -blacklist eepro100 - -# replaced by tulip -blacklist de4x5 - -# replaced by tmscsim -blacklist am53c974 - -# these watchdog drivers break some systems -blacklist iTCO_wdt - diff --git a/extra/create_static_nodes b/extra/create_static_nodes deleted file mode 100644 index 46602ad..0000000 --- a/extra/create_static_nodes +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -e - -make_extra_nodes() { - [ -e /etc/udev/links.conf ] || return 0 - - grep '^[^#]' /etc/udev/links.conf | \ - while read type name arg1; do - [ "$type" -a "$name" -a ! -e "/$1/$name" -a ! -L "/$1/$name" ] || continue - case "$type" in - L) ln -s $arg1 /$1/$name ;; - D) mkdir -p /$1/$name ;; - M) mknod -m 600 /$1/$name $arg1 ;; - *) echo "links.conf: unparseable line ($type $name $arg1)" >&2 ;; - esac - - if [ -x /sbin/restorecon ]; then - /sbin/restorecon /dev/$name - fi - done -} - -if [ "$1" ]; then - devdir="$1" -else - devdir='/dev' -fi - -make_extra_nodes $devdir - -exit 0 - diff --git a/extra/dsl-modem.agent b/extra/dsl-modem.agent deleted file mode 100644 index d419c03..0000000 --- a/extra/dsl-modem.agent +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/sh -e -# -# Copyright 2008 Marco d'Itri -# -# This script automatically starts networking when a DSL modem is connected -# and its ATM interface is ready. -# -# -# For PPPoE you can set PROTOCOL=2684bridged and then add something like -# this to /etc/network/interfaces: -# -# allow-hotplug nas0 -# iface nas0 inet manual -# pre-up ip link set up $IFACE -# up pppd persist call dsl-provider -# -# -# Support for CLIP (Classical IP over ATM, RFC 1577) may be incomplete. -# - -# defaults -[ "$IP_INTERFACE" ] || IP_INTERFACE='nas0' -[ "$VP" ] || VP='8' -[ "$VC" ] || VC='35' - -if [ -e /etc/default/dsl-modem.agent ]; then - . /etc/default/dsl-modem.agent -fi - -# just exit unless a protocol is configured -[ "$PROTOCOL" ] || exit 0 - -############################################################################## -wait_and_run_pppd() { - # this guarantees that everything pppd needs to work is ready - wait_for_file /dev/log - - exec pppd persist call ${PPP_PEER:-dsl-provider} -} - -wait_and_run_br2684ctl() { - wait_for_file /dev/log - - exec br2684ctl $BR2684_ARGS -b -c ${IP_INTERFACE#nas} \ - -a ${ATM_INTERFACE}.${VP}.${VC} -} - -wait_and_run_atmarp() { - wait_for_file /var/run/atmarpd.table - - # create the IP interface - atmarp -c ${IP_INTERFACE:-atm0} - # setup the VC -# atmarp -s 192.0.2.254 ${ATM_INTERFACE}.${VP}.${VC} - exec ifup ${IP_INTERFACE:-atm0} # XXX -} - -############################################################################## -ATM_DRIVER=${NAME%%[0-9]*} -ATM_INTERFACE=${NAME##$ATM_DRIVER} - -# is this a DSL modem? -case "$ATM_DRIVER" in -cxacru|speedtch|ueagle-atm|xusbatm|UNICORN) ;; -*) exit 0 ;; -esac - -cd /lib/udev/ -. ./hotplug.functions - -############################################################################## -case "$ACTION" in -add) - case "$PROTOCOL" in - pppoa) wait_and_run_pppd & ;; - 2684bridged) wait_and_run_br2684ctl & ;; - clip) wait_and_run_atmarp & ;; - esac - ;; - -remove) - case "$PROTOCOL" in - pppoa) - # pppd will terminate automatically - ;; - 2684bridged) - PIDFILE="/var/run/br2684ctl-$IP_INTERFACE.pid" - if [ -e $PIDFILE ]; then - kill $(cat $PIDFILE) - rm -f $PIDFILE - fi - ;; - clip) - ifdown ${IP_INTERFACE:-atm0} # XXX -# atmarp -d 192.0.2.254 - ;; - esac - ;; -esac - -exit 0 - diff --git a/extra/fbdev-blacklist.conf b/extra/fbdev-blacklist.conf deleted file mode 100644 index 0e0bd8c..0000000 --- a/extra/fbdev-blacklist.conf +++ /dev/null @@ -1,25 +0,0 @@ -# This file blacklists the framebuffer drivers. - -blacklist arkfb -blacklist aty128fb -blacklist atyfb -blacklist radeonfb -blacklist cirrusfb -blacklist cyber2000fb -blacklist gx1fb -blacklist gxfb -blacklist lxfb -blacklist kyrofb -blacklist matroxfb_base -blacklist mb862xxfb -blacklist neofb -blacklist nvidiafb -blacklist pm2fb -blacklist pm3fb -blacklist s3fb -blacklist savagefb -blacklist sisfb -blacklist tdfxfb -blacklist tridentfb -blacklist viafb -blacklist vt8623fb diff --git a/extra/firmware.agent b/extra/firmware.agent deleted file mode 100644 index 78f9999..0000000 --- a/extra/firmware.agent +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -e -# -# firmware loader agent -# - -cd /lib/udev/ -. ./hotplug.functions - -if [ ! -e /sys/$DEVPATH/loading ]; then - mesg "/sys/$DEVPATH/ does not exist" - exit 1 -fi - -FIRMWARE_DIRS="/lib/firmware/$(uname -r) /lib/firmware /usr/local/lib/firmware /usr/lib/hotplug/firmware" - -for DIR in $FIRMWARE_DIRS; do - [ -e "$DIR/$FIRMWARE" ] || continue - echo 1 > /sys/$DEVPATH/loading - cat "$DIR/$FIRMWARE" > /sys/$DEVPATH/data - echo 0 > /sys/$DEVPATH/loading - exit 0 -done - -# the firmware was not found -echo -1 > /sys/$DEVPATH/loading - -if [ -d /dev/.udev/ ]; then - mkdir -p /dev/.udev/firmware-missing/ - file=$(echo "$FIRMWARE" | sed -e 's#/#\\x2f#g') - ln -s -f "$DEVPATH" /dev/.udev/firmware-missing/$file -fi - -debug_mesg "Cannot find the $FIRMWARE firmware" -exit 1 - diff --git a/extra/hotplug.functions b/extra/hotplug.functions deleted file mode 100644 index aed7f33..0000000 --- a/extra/hotplug.functions +++ /dev/null @@ -1,61 +0,0 @@ -# Setup and shell utility functions for use in hotplug agents. -# vim: syntax=sh -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation version 2 of the License. - -if [ "$UDEV_LOG" ] && [ "$UDEV_LOG" -ge 7 ]; then - DEBUG=yes -fi - -PATH='/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin' - -[ -e /etc/default/hotplug ] && . /etc/default/hotplug - - -if [ -x /usr/bin/logger ]; then - LOGGER=/usr/bin/logger -elif [ -x /bin/logger ]; then - LOGGER=/bin/logger -else - unset LOGGER -fi - -# for diagnostics -if [ -t 1 -a -z "$LOGGER" ] || [ ! -e '/dev/log' ]; then - mesg() { - echo "$@" >&2 - } -elif [ -t 1 ]; then - mesg() { - echo "$@" - $LOGGER -t "${0##*/}[$$]" "$@" - } -else - mesg() { - $LOGGER -t "${0##*/}[$$]" "$@" - } -fi - -debug_mesg() { - [ -z "$DEBUG" -o "$DEBUG" = no ] && return 0 - mesg "$@" -} - -wait_for_file() { - local file=$1 - local timeout=$2 - [ "$timeout" ] || timeout=120 - - local count=$timeout - while [ $count != 0 ]; do - [ -e "$file" ] && return 0 - sleep 1 - count=$(($count - 1)) - done - - mesg "$file did not appear before the timeout!" - exit 1 -} - diff --git a/extra/initramfs.bottom b/extra/initramfs.bottom deleted file mode 100644 index b034d34..0000000 --- a/extra/initramfs.bottom +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -e - -PREREQS="" - -prereqs() { echo "$PREREQS"; } - -case "$1" in - prereqs) - prereqs - exit 0 - ;; -esac - -# Stop udevd, we'll miss a few events while we run init, but we catch up -for proc in /proc/[0-9]*; do - [ -x $proc/exe ] || continue - if [ "$(readlink $proc/exe)" = /sbin/udevd ]; then - # errors must be ignored due to a race with udevd child processes - # naturally terminating - kill ${proc#/proc/} 2> /dev/null || true - fi -done - -udev_root="/dev" -if [ -e /etc/udev/udev.conf ]; then - . /etc/udev/udev.conf -fi - -# move the /dev tmpfs to the rootfs -mount -n -o move /dev ${rootmnt}${udev_root} - -# create a temporary symlink to the final /dev for other initramfs scripts -nuke /dev -ln -s ${rootmnt}${udev_root} /dev - diff --git a/extra/initramfs.hook b/extra/initramfs.hook deleted file mode 100644 index 60be1df..0000000 --- a/extra/initramfs.hook +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh -e - -PREREQS="" - -prereqs() { echo "$PREREQS"; } - -case "$1" in - prereqs) - prereqs - exit 0 - ;; -esac - -root_over_the_network() { - if egrep -q '^/dev/(nbd|nd[a-z]|etherd/e)[^[:space:]]+[[:space:]]+/[[:space:]]' /etc/fstab; then - return 0 - elif egrep -q '^[^[:space:]#]+[[:space:]]+/[[:space:]]+nfs[234]?[[:space:]]' /etc/fstab; then - return 0 - fi - return 1 # false -} - -. /usr/share/initramfs-tools/hook-functions - -# udevd uses unix domain sockets for communication -force_load unix - -copy_exec /sbin/udevd /sbin -copy_exec /sbin/udevadm /sbin - -mkdir -p $DESTDIR/etc/udev -cp -p /etc/udev/udev.conf $DESTDIR/etc/udev/ - -mkdir -p $DESTDIR/lib/udev/rules.d/ -for rules in 50-udev-default.rules 60-persistent-storage.rules \ - 80-drivers.rules 91-permissions.rules \ - 64-md-raid.rules 60-persistent-storage-lvm.rules \ - 55-dm.rules 60-persistent-storage-dm.rules; do - if [ -e /etc/udev/rules.d/$rules ]; then - cp -p /etc/udev/rules.d/$rules $DESTDIR/lib/udev/rules.d/ - elif [ -e /lib/udev/rules.d/$rules ]; then - cp -p /lib/udev/rules.d/$rules $DESTDIR/lib/udev/rules.d/ - fi -done - -# try to autodetect the value of this configuration option -if [ -z "$NEED_PERSISTENT_NET" ] && root_over_the_network; then - NEED_PERSISTENT_NET='yes' -fi - -# Copy the rules for persistent network interface names for the benefit of -# systems which need to boot over the network. If this is enabled then the -# initramfs must be rebuilt every time a new network interface is added. -# See #414287 for details. -case "$NEED_PERSISTENT_NET" in -YES|yes|Yes|Y|y) - if [ -e /etc/udev/rules.d/70-persistent-net.rules ]; then - cp -p /etc/udev/rules.d/70-persistent-net.rules $DESTDIR/lib/udev/rules.d/ - fi - ;; -esac - -cp /lib/udev/hotplug.functions $DESTDIR/lib/udev/ -for program in firmware.agent ata_id edd_id path_id scsi_id usb_id; do - copy_exec /lib/udev/$program /lib/udev -done -copy_exec /sbin/blkid /sbin - -if [ -x /lib/udev/vio_type ]; then - copy_exec /lib/udev/vio_type /lib/udev -fi - diff --git a/extra/initramfs.top b/extra/initramfs.top deleted file mode 100644 index 15e9bf3..0000000 --- a/extra/initramfs.top +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -e - -PREREQS="" - -prereqs() { echo "$PREREQS"; } - -case "$1" in - prereqs) - prereqs - exit 0 - ;; -esac - -echo > /sys/kernel/uevent_helper - -UDEV_ROOT=/dev \ -udevd --daemon --resolve-names=never - -udevadm trigger --action=add -udevadm settle || true - -if [ -d /sys/bus/scsi ]; then - modprobe -q scsi_wait_scan && modprobe -r scsi_wait_scan || true - udevadm settle || true -fi - -# If the rootdelay parameter has been set, we wait a bit for devices -# like usb/firewire disks to settle. -if [ "$ROOTDELAY" ]; then - sleep $ROOTDELAY -fi - -# Leave udev running to process events that come in out-of-band (like USB -# connections) diff --git a/extra/links.conf b/extra/links.conf deleted file mode 100644 index 16d069e..0000000 --- a/extra/links.conf +++ /dev/null @@ -1,15 +0,0 @@ -# This file does not exist. Please do not ask the Debian maintainer about it. -# If you need manually created devices, create them in /lib/udev/devices/ . - -D pts -D shm - -M null c 1 3 -M console c 5 1 - -# Hic sunt leones. -M ppp c 108 0 -M loop0 b 7 0 -D net -M net/tun c 10 200 - diff --git a/extra/logger.agent b/extra/logger.agent deleted file mode 100644 index 7e68f17..0000000 --- a/extra/logger.agent +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -e -# -# log the event to a file -# - -cd /lib/udev/ -. ./hotplug.functions - -# provide env-like output when the real thing is not available -if [ ! -x /usr/bin/env ]; then - env() { - # bash prepends "declare -x " at the beginning of each line - export -p | sed -e 's/^\(declare -x\|export\) //' - } -fi - -# writes a copy of the current hotplug event to stdout -log_to_stdout() -{ - { - echo "HOTPLUG_TIME='$(date)'" - env - echo '' - } | egrep -v "^'$|^(_|PATH|PWD|PPID|SHLVL|HOME|IFS|OPTIND|PS[1234])=" -} - -[ "$EVENTS_LOG" ] || EVENTS_LOG='/dev/hotplug.log' - -log_to_stdout >> $EVENTS_LOG - -exit 0 - diff --git a/extra/make-fbdev-blacklist b/extra/make-fbdev-blacklist deleted file mode 100644 index bb092e4..0000000 --- a/extra/make-fbdev-blacklist +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# This script should be run before building the package every time a new -# kernel is released. - -set -e - -BL='fbdev-blacklist.conf' - -if [ -e extra/$BL ]; then cd extra; fi - -{ -printf "# This file blacklists the framebuffer drivers.\n\n" - -find /lib/modules/$(uname -r)/kernel/drivers/video -type f | sort | \ -while read file; do - /sbin/modinfo $file | grep -q '^alias: *pci:' \ - && echo blacklist $(basename $file .ko) || true -done -} > $BL.tmp - -if diff --unified=0 $BL $BL.tmp; then - rm $BL.tmp -else - printf "\n\n\n$BL.tmp has changes!\n\n\n\n" -fi - diff --git a/extra/net.agent b/extra/net.agent deleted file mode 100644 index f4275bc..0000000 --- a/extra/net.agent +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/sh -e -# -# run /sbin/{ifup,ifdown} with the --allow=hotplug option. -# - -. /lib/udev/hotplug.functions - -if [ -z "$INTERFACE" ]; then - mesg "Bad net.agent invocation: \$INTERFACE is not set" - exit 1 -fi - -check_program() { - [ -x $1 ] && return 0 - - mesg "ERROR: $1 not found. You need to install the ifupdown package." - mesg "net.agent $ACTION event for $INTERFACE not handled." - exit 1 -} - -wait_for_interface() { - local interface=$1 - - while :; do - local state="$(cat /sys/class/net/$interface/operstate 2>/dev/null || true)" - if [ "$state" != down ]; then - return 0 - fi - sleep 1 - done -} - -net_ifup() { - check_program /sbin/ifup - - if grep -q '^auto[[:space:]].*\<'"$INTERFACE"'\>' \ - /etc/network/interfaces; then - # this $INTERFACE is marked as "auto" - IFUPARG='\('$INTERFACE'\|-a\|--all\)' - else - IFUPARG=$INTERFACE - fi - - if ps -C ifup ho args | grep -q "$IFUPARG"; then - debug_mesg "Already ifup-ing interface $INTERFACE" - exit 0 - fi - - wait_for_interface lo - if [ -e /bin/systemctl ]; then - wait_for_file /dev/log - fi - - exec ifup --allow=hotplug $INTERFACE -} - -net_ifdown() { - check_program /sbin/ifdown - - if ps -C ifdown ho args | grep -q $INTERFACE; then - debug_mesg "Already ifdown-ing interface $INTERFACE" - exit 0 - fi - - exec ifdown --allow=hotplug $INTERFACE -} - -do_everything() { - -case "$ACTION" in - add) - # these interfaces generate hotplug events *after* they are brought up - case $INTERFACE in - ppp*|ippp*|isdn*|plip*|lo|irda*|ipsec*) - exit 0 ;; - esac - - net_ifup - ;; - - remove) - # the pppd persist option may have been used, so it should not be killed - case $INTERFACE in - ppp*) - exit 0 ;; - esac - - net_ifdown - ;; - - *) - debug_mesg "NET $ACTION event not supported" - exit 1 - ;; -esac - -} - -# When udev_log="debug" stdout and stderr are pipes connected to udevd. -# They need to be closed or udevd will wait for this process which will -# deadlock with udevsettle until the timeout. -do_everything > /dev/null 2> /dev/null & - -exit 0 - diff --git a/extra/subst_lib_name b/extra/subst_lib_name deleted file mode 100644 index 4556ad6..0000000 --- a/extra/subst_lib_name +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/perl - -use warnings; -use strict; - -my $base = $ARGV[0] || die; - -my $file = "$base/lib/udev/rules.d/70-acl.rules"; -my $program = "$base/lib/udev/udev-acl"; -my $library = 'libglib-2.0.so.0'; - -############################################################################## -my $rules = read_file($file); - -my $libfile = library_path($program, $library) - or die "Cannot find the path of $library in $program!"; - -$rules =~ s#\@GLIB_PATH\@#$libfile#; - -print "Updating $file for $libfile.\n"; -write_file($file, $rules); - -exit 0; - -############################################################################## -sub library_path { - my ($file, $library) = @_; - - open(LDD, "ldd $file |") or die "open(ldd $file |): $!"; - my $libfile; - while () { - next unless m#^\s*(\S+)\s+=>\s+(\S+)\s+#; - next unless $1 eq $library; - $libfile = $2; - } - close LDD or die "close(ldd $file |): status=$?"; - - return $libfile; -} - -############################################################################## -sub read_file { - my ($file) = @_; - open(FILE, $file) or die "open($file): $!"; - local $/ = undef; - my $data = ; - close FILE; - return $data; -} - -sub write_file { - my ($file, $data) = @_; - open(FILE, '>', $file) or die "open(> $file): $!"; - print FILE $data; - close FILE or die "close($file): $!"; -} - diff --git a/extra/udev.base-installer b/extra/udev.base-installer deleted file mode 100644 index 8a8d299..0000000 --- a/extra/udev.base-installer +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -e - -RULESDIR=etc/udev/rules.d - -mkdir -p /target/$RULESDIR -cp /$RULESDIR/70-persistent-*.rules /target/$RULESDIR 2>/dev/null || true - diff --git a/extra/udev.startup b/extra/udev.startup deleted file mode 100644 index ab2e12b..0000000 --- a/extra/udev.startup +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -e - -make_extra_nodes() { - [ -e /etc/udev/links.conf ] || return 0 - grep '^[^#]' /etc/udev/links.conf | \ - while read type name arg1; do - [ "$type" -a "$name" -a ! -e "/dev/$name" -a ! -L "/dev/$name" ] ||continue - case "$type" in - L) ln -s $arg1 /dev/$name ;; - D) mkdir -p /dev/$name ;; - M) mknod -m 600 /dev/$name $arg1 ;; - *) echo "links.conf: unparseable line ($type $name $arg1)" ;; - esac - done -} - -echo > /sys/kernel/uevent_helper - -if ! grep -E -q "^[^[:space:]]+ /dev (dev)?tmpfs" /proc/mounts; then - mount -n -o mode=0755 -t tmpfs tmpfs /dev -fi -make_extra_nodes - -udevd --daemon --resolve-names=never - -udevadm trigger --action=add - -mount /dev/pts - -udevadm settle || true - -if [ -d /sys/bus/scsi ]; then - modprobe -q scsi_wait_scan && modprobe -r scsi_wait_scan || true - udevadm settle || true -fi - -exit 0 - diff --git a/extra/udev.vim b/extra/udev.vim deleted file mode 100644 index 9282159..0000000 --- a/extra/udev.vim +++ /dev/null @@ -1,45 +0,0 @@ -" Vim syntax file -" Language: udev rules files -" Maintainer: Marco d'Itri -" Last Change: 2005 August -" -" This syntax file is unfinished. If you can, please clean it up and submit -" it for inclusion in the vim package. - -if exists("b:current_syntax") - finish -endif - -let b:current_syntax = "udev" - -syn keyword Ucondition ACTION ENV RESULT KERNEL SUBSYSTEM DRIVER ATTR -syn keyword Ucondition KERNELS SUBSYSTEMS DRIVERS ATTRS DEVPATH TEST -syn keyword Ucondition nextgroup=Uparambr,Uoperator -syn keyword Uaction PROGRAM NAME SYMLINK OWNER GROUP MODE RUN OPTIONS -syn keyword Uaction IMPORT GOTO LABEL -syn keyword Uaction nextgroup=Uparambr,Uoperator -syn region Uparambr start=/{/ end=/}/ contains=Uparam -syn match Uparam '[A-Za-z0-9_]*' contained -syn match Ufnmatch "[?*|]" contained -syn region Ufnmatch start=/\[/ skip=/\\\]/ end=/\]/ contained -syn match Uprintf '%[beknMmps%]\|%c{[0-9]}' contained -syn match Ustringvar '\$[a-z]*' nextgroup=Uparambr -syn match Ustring '"[^"]*"' contains=Uprintf,Ufnmatch,Ustringvar -syn match Uoperator "==\|!=\|=\|+=\|:=\|," -syn match Ueol '\\$' -syn region Ucomment start=/#/ end=/$/ -syn keyword Utodo contained TODO FIXME XXX - -hi def link Ucondition Identifier -hi def link Uaction Identifier -hi def link Uparambr Delimiter -hi def link Uparam PreProc -hi def link Ufnmatch Special -hi def link Uprintf Special -hi def link Ustringvar Function -hi def link Ustring String -hi def link Uoperator Operator -hi def link Ueol Delimiter -hi def link Ucomment Comment -hi def link Utodo Todo - diff --git a/extras/accelerometer/61-accelerometer.rules b/extras/accelerometer/61-accelerometer.rules new file mode 100644 index 0000000..a6a2bfd --- /dev/null +++ b/extras/accelerometer/61-accelerometer.rules @@ -0,0 +1,3 @@ +# do not edit this file, it will be overwritten on update + +SUBSYSTEM=="input", ACTION!="remove", ENV{ID_INPUT_ACCELEROMETER}=="1", IMPORT{program}="accelerometer %p" diff --git a/extras/accelerometer/accelerometer.c b/extras/accelerometer/accelerometer.c new file mode 100644 index 0000000..59c2a4e --- /dev/null +++ b/extras/accelerometer/accelerometer.c @@ -0,0 +1,357 @@ +/* + * accelerometer - exports device orientation through property + * + * When an "change" event is received on an accelerometer, + * open its device node, and from the value, as well as the previous + * value of the property, calculate the device's new orientation, + * and export it as ID_INPUT_ACCELEROMETER_ORIENTATION. + * + * Possible values are: + * undefined + * * normal + * * bottom-up + * * left-up + * * right-up + * + * The property will be persistent across sessions, and the new + * orientations can be deducted from the previous one (it allows + * for a threshold for switching between opposite ends of the + * orientation). + * + * Copyright (C) 2011 Red Hat, Inc. + * Author: + * Bastien Nocera + * + * orientation_calc() from the sensorfw package + * Copyright (C) 2009-2010 Nokia Corporation + * Authors: + * Üstün Ergenoglu + * Timo Rongas + * Lihan Guo + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with keymap; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +/* we must use this kernel-compatible implementation */ +#define BITS_PER_LONG (sizeof(unsigned long) * 8) +#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) +#define OFF(x) ((x)%BITS_PER_LONG) +#define BIT(x) (1UL<> OFF(bit)) & 1) + +static int debug = 0; + +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + if (debug) { + fprintf(stderr, "%s: ", fn); + vfprintf(stderr, format, args); + } else { + vsyslog(priority, format, args); + } +} + +typedef enum { + ORIENTATION_UNDEFINED, + ORIENTATION_NORMAL, + ORIENTATION_BOTTOM_UP, + ORIENTATION_LEFT_UP, + ORIENTATION_RIGHT_UP +} OrientationUp; + +static const char *orientations[] = { + "undefined", + "normal", + "bottom-up", + "left-up", + "right-up", + NULL +}; + +#define ORIENTATION_UP_UP ORIENTATION_NORMAL + +#define DEFAULT_THRESHOLD 250 +#define RADIANS_TO_DEGREES 180.0/M_PI +#define SAME_AXIS_LIMIT 5 + +#define THRESHOLD_LANDSCAPE 25 +#define THRESHOLD_PORTRAIT 20 + +static const char * +orientation_to_string (OrientationUp o) +{ + return orientations[o]; +} + +static OrientationUp +string_to_orientation (const char *orientation) +{ + int i; + + if (orientation == NULL) + return ORIENTATION_UNDEFINED; + for (i = 0; orientations[i] != NULL; i++) { + if (strcmp (orientation, orientations[i]) == 0) + return i; + } + return ORIENTATION_UNDEFINED; +} + +static OrientationUp +orientation_calc (OrientationUp prev, + int x, int y, int z) +{ + int rotation; + OrientationUp ret = prev; + + /* Portrait check */ + rotation = round(atan((double) x / sqrt(y * y + z * z)) * RADIANS_TO_DEGREES); + + if (abs(rotation) > THRESHOLD_PORTRAIT) { + ret = (rotation < 0) ? ORIENTATION_LEFT_UP : ORIENTATION_RIGHT_UP; + + /* Some threshold to switching between portrait modes */ + if (prev == ORIENTATION_LEFT_UP || prev == ORIENTATION_RIGHT_UP) { + if (abs(rotation) < SAME_AXIS_LIMIT) { + ret = prev; + } + } + + } else { + /* Landscape check */ + rotation = round(atan((double) y / sqrt(x * x + z * z)) * RADIANS_TO_DEGREES); + + if (abs(rotation) > THRESHOLD_LANDSCAPE) { + ret = (rotation < 0) ? ORIENTATION_BOTTOM_UP : ORIENTATION_NORMAL; + + /* Some threshold to switching between landscape modes */ + if (prev == ORIENTATION_BOTTOM_UP || prev == ORIENTATION_NORMAL) { + if (abs(rotation) < SAME_AXIS_LIMIT) { + ret = prev; + } + } + } + } + + return ret; +} + +static OrientationUp +get_prev_orientation(struct udev_device *dev) +{ + const char *value; + + value = udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER_ORIENTATION"); + if (value == NULL) + return ORIENTATION_UNDEFINED; + return string_to_orientation(value); +} + +#define SET_AXIS(axis, code_) if (ev[i].code == code_) { if (got_##axis == 0) { axis = ev[i].value; got_##axis = 1; } } + +/* accelerometers */ +static void test_orientation(struct udev *udev, + struct udev_device *dev, + const char *devpath) +{ + OrientationUp old, new; + int fd, r; + struct input_event ev[64]; + int got_syn = 0; + int got_x, got_y, got_z; + int x = 0, y = 0, z = 0; + char text[64]; + + old = get_prev_orientation(dev); + + if ((fd = open(devpath, O_RDONLY)) < 0) + return; + + got_x = got_y = got_z = 0; + + while (1) { + int i; + + r = read(fd, ev, sizeof(struct input_event) * 64); + + if (r < (int) sizeof(struct input_event)) + return; + + for (i = 0; i < r / (int) sizeof(struct input_event); i++) { + if (got_syn == 1) { + if (ev[i].type == EV_ABS) { + SET_AXIS(x, ABS_X); + SET_AXIS(y, ABS_Y); + SET_AXIS(z, ABS_Z); + } + } + if (ev[i].type == EV_SYN && ev[i].code == SYN_REPORT) { + got_syn = 1; + } + if (got_x && got_y && got_z) + goto read_dev; + } + } + +read_dev: + close(fd); + + if (!got_x || !got_y || !got_z) + return; + + new = orientation_calc(old, x, y, z); + snprintf(text, sizeof(text), "ID_INPUT_ACCELEROMETER_ORIENTATION=%s", orientation_to_string(new)); + puts(text); +} + +static void help(void) +{ + printf("Usage: accelerometer [options] \n" + " --debug debug to stderr\n" + " --help print this help text\n\n"); +} + +int main (int argc, char** argv) +{ + struct udev *udev; + struct udev_device *dev; + + static const struct option options[] = { + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + + char devpath[PATH_MAX]; + char *devnode; + const char *id_path; + struct udev_enumerate *enumerate; + struct udev_list_entry *list_entry; + + udev = udev_new(); + if (udev == NULL) + return 1; + + udev_log_init("input_id"); + udev_set_log_fn(udev, log_fn); + + /* CLI argument parsing */ + while (1) { + int option; + + option = getopt_long(argc, argv, "dxh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'd': + debug = 1; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'h': + help(); + exit(0); + default: + exit(1); + } + } + + if (argv[optind] == NULL) { + help(); + exit(1); + } + + /* get the device */ + snprintf(devpath, sizeof(devpath), "%s/%s", udev_get_sys_path(udev), argv[optind]); + dev = udev_device_new_from_syspath(udev, devpath); + if (dev == NULL) { + fprintf(stderr, "unable to access '%s'\n", devpath); + return 1; + } + + id_path = udev_device_get_property_value(dev, "ID_PATH"); + if (id_path == NULL) { + fprintf (stderr, "unable to get property ID_PATH for '%s'", devpath); + return 0; + } + + /* Get the children devices and find the devnode + * FIXME: use udev_enumerate_add_match_children() instead + * when it's available */ + devnode = NULL; + enumerate = udev_enumerate_new(udev); + udev_enumerate_add_match_property(enumerate, "ID_PATH", id_path); + udev_enumerate_add_match_subsystem(enumerate, "input"); + udev_enumerate_scan_devices(enumerate); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { + struct udev_device *device; + const char *node; + + device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), + udev_list_entry_get_name(list_entry)); + if (device == NULL) + continue; + /* Already found it */ + if (devnode != NULL) { + udev_device_unref(device); + continue; + } + + node = udev_device_get_devnode(device); + if (node == NULL) { + udev_device_unref(device); + continue; + } + /* Use the event sub-device */ + if (strstr(node, "/event") == NULL) { + udev_device_unref(device); + continue; + } + + devnode = strdup(node); + udev_device_unref(device); + } + + if (devnode == NULL) { + fprintf(stderr, "unable to get device node for '%s'\n", devpath); + return 0; + } + + info(udev, "Opening accelerometer device %s\n", devnode); + test_orientation(udev, dev, devnode); + free(devnode); + + return 0; +} diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 594cfb2..e38a7d1 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -448,6 +448,7 @@ int main(int argc, char *argv[]) struct udev *udev; struct hd_driveid id; uint8_t identify[512]; + uint16_t *identify_words; char model[41]; char model_enc[256]; char serial[21]; @@ -486,8 +487,6 @@ int main(int argc, char *argv[]) printf("Usage: ata_id [--export] [--help] \n" " --export print values as environment keys\n" " --help print this help text\n\n"); - default: - rc = 1; goto exit; } } @@ -537,22 +536,23 @@ int main(int argc, char *argv[]) info(udev, "HDIO_GET_IDENTITY unsupported for '%s'\n", node); rc = 2; } else { - err(udev, "HDIO_GET_IDENTITY failed for '%s'\n", node); + err(udev, "HDIO_GET_IDENTITY failed for '%s': %m\n", node); rc = 3; } goto close; } } + identify_words = (uint16_t *) identify; memcpy (model, id.model, 40); model[40] = '\0'; udev_util_encode_string(model, model_enc, sizeof(model_enc)); - udev_util_replace_whitespace((char *) id.model, model, 40); - udev_util_replace_chars(model, NULL); - udev_util_replace_whitespace((char *) id.serial_no, serial, 20); - udev_util_replace_chars(serial, NULL); - udev_util_replace_whitespace((char *) id.fw_rev, revision, 8); - udev_util_replace_chars(revision, NULL); + util_replace_whitespace((char *) id.model, model, 40); + util_replace_chars(model, NULL); + util_replace_whitespace((char *) id.serial_no, serial, 20); + util_replace_chars(serial, NULL); + util_replace_whitespace((char *) id.fw_rev, revision, 8); + util_replace_chars(revision, NULL); if (export) { /* Set this to convey the disk speaks the ATA protocol */ @@ -702,6 +702,15 @@ int main(int argc, char *argv[]) /* ATA devices have no vendor extension */ printf("ID_WWN_WITH_EXTENSION=0x%llx\n", (unsigned long long int) wwwn); } + + /* from Linux's include/linux/ata.h */ + if (identify_words[0] == 0x848a || identify_words[0] == 0x844a) { + printf("ID_ATA_CFA=1\n"); + } else { + if ((identify_words[83] & 0xc004) == 0x4004) { + printf("ID_ATA_CFA=1\n"); + } + } } else { if (serial[0] != '\0') printf("%s_%s\n", model, serial); diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules index b3109f1..896af34 100644 --- a/extras/cdrom_id/60-cdrom_id.rules +++ b/extras/cdrom_id/60-cdrom_id.rules @@ -5,7 +5,14 @@ SUBSYSTEM!="block", GOTO="cdrom_end" KERNEL!="sr[0-9]*|xvd*", GOTO="cdrom_end" ENV{DEVTYPE}!="disk", GOTO="cdrom_end" +# unconditionally tag device as CDROM KERNEL=="sr[0-9]*", ENV{ID_CDROM}="1" -IMPORT{program}="cdrom_id --export $tempnode" + +# media eject button pressed +ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $tempnode", GOTO="cdrom_end" + +# import device and media properties and lock tray to +# enable the receiving of media eject button events +IMPORT{program}="cdrom_id --lock-media $tempnode" LABEL="cdrom_end" diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index f0e1cbb..664a00d 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -41,7 +41,7 @@ #include "libudev.h" #include "libudev-private.h" -static int debug; +static bool debug; static void log_fn(struct udev *udev, int priority, const char *file, int line, const char *fn, @@ -156,13 +156,11 @@ struct scsi_cmd { struct sg_io_hdr sg_io; }; -static void scsi_cmd_init(struct udev *udev, struct scsi_cmd *cmd, unsigned char *buf, size_t bufsize) +static void scsi_cmd_init(struct udev *udev, struct scsi_cmd *cmd) { memset(cmd, 0x00, sizeof(struct scsi_cmd)); - memset(buf, 0x00, bufsize); cmd->cgc.quiet = 1; cmd->cgc.sense = &cmd->_sense.s; - memset(&cmd->sg_io, 0, sizeof(cmd->sg_io)); cmd->sg_io.interface_id = 'S'; cmd->sg_io.mx_sb_len = sizeof(cmd->_sense); cmd->sg_io.cmdp = cmd->cgc.cmd; @@ -182,9 +180,13 @@ static int scsi_cmd_run(struct udev *udev, struct scsi_cmd *cmd, int fd, unsigne { int ret = 0; - cmd->sg_io.dxferp = buf; - cmd->sg_io.dxfer_len = bufsize; - cmd->sg_io.dxfer_direction = SG_DXFER_FROM_DEV; + if (bufsize > 0) { + cmd->sg_io.dxferp = buf; + cmd->sg_io.dxfer_len = bufsize; + cmd->sg_io.dxfer_direction = SG_DXFER_FROM_DEV; + } else { + cmd->sg_io.dxfer_direction = SG_DXFER_NONE; + } if (ioctl(fd, SG_IO, &cmd->sg_io)) return -1; @@ -200,6 +202,39 @@ static int scsi_cmd_run(struct udev *udev, struct scsi_cmd *cmd, int fd, unsigne return ret; } +static int media_lock(struct udev *udev, int fd, bool lock) +{ + int err; + + /* disable the kernel's lock logic */ + err = ioctl(fd, CDROM_CLEAR_OPTIONS, CDO_LOCK); + if (err < 0) + info(udev, "CDROM_CLEAR_OPTIONS, CDO_LOCK failed\n"); + + err = ioctl(fd, CDROM_LOCKDOOR, lock ? 1 : 0); + if (err < 0) + info(udev, "CDROM_LOCKDOOR failed\n"); + + return err; +} + +static int media_eject(struct udev *udev, int fd) +{ + struct scsi_cmd sc; + int err; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x1b); + scsi_cmd_set(udev, &sc, 4, 0x02); + scsi_cmd_set(udev, &sc, 5, 0); + err = scsi_cmd_run(udev, &sc, fd, NULL, 0); + if ((err != 0)) { + info_scsi_cmd_err(udev, "START_STOP_UNIT", err); + return -1; + } + return 0; +} + static int cd_capability_compat(struct udev *udev, int fd) { int capability; @@ -237,12 +272,13 @@ static int cd_media_compat(struct udev *udev, int fd) return 0; } -static int cd_inquiry(struct udev *udev, int fd) { +static int cd_inquiry(struct udev *udev, int fd) +{ struct scsi_cmd sc; unsigned char inq[128]; int err; - scsi_cmd_init(udev, &sc, inq, sizeof(inq)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x12); scsi_cmd_set(udev, &sc, 4, 36); scsi_cmd_set(udev, &sc, 5, 0); @@ -261,6 +297,115 @@ static int cd_inquiry(struct udev *udev, int fd) { return 0; } +static void feature_profile_media(struct udev *udev, int cur_profile) +{ + switch (cur_profile) { + case 0x03: + case 0x04: + case 0x05: + info(udev, "profile 0x%02x \n", cur_profile); + cd_media = 1; + cd_media_mo = 1; + break; + case 0x08: + info(udev, "profile 0x%02x media_cd_rom\n", cur_profile); + cd_media = 1; + cd_media_cd_rom = 1; + break; + case 0x09: + info(udev, "profile 0x%02x media_cd_r\n", cur_profile); + cd_media = 1; + cd_media_cd_r = 1; + break; + case 0x0a: + info(udev, "profile 0x%02x media_cd_rw\n", cur_profile); + cd_media = 1; + cd_media_cd_rw = 1; + break; + case 0x10: + info(udev, "profile 0x%02x media_dvd_ro\n", cur_profile); + cd_media = 1; + cd_media_dvd_rom = 1; + break; + case 0x11: + info(udev, "profile 0x%02x media_dvd_r\n", cur_profile); + cd_media = 1; + cd_media_dvd_r = 1; + break; + case 0x12: + info(udev, "profile 0x%02x media_dvd_ram\n", cur_profile); + cd_media = 1; + cd_media_dvd_ram = 1; + break; + case 0x13: + info(udev, "profile 0x%02x media_dvd_rw_ro\n", cur_profile); + cd_media = 1; + cd_media_dvd_rw = 1; + cd_media_dvd_rw_ro = 1; + break; + case 0x14: + info(udev, "profile 0x%02x media_dvd_rw_seq\n", cur_profile); + cd_media = 1; + cd_media_dvd_rw = 1; + cd_media_dvd_rw_seq = 1; + break; + case 0x1B: + info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_r = 1; + break; + case 0x1A: + info(udev, "profile 0x%02x media_dvd_plus_rw\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_rw = 1; + break; + case 0x2A: + info(udev, "profile 0x%02x media_dvd_plus_rw_dl\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_rw_dl = 1; + break; + case 0x2B: + info(udev, "profile 0x%02x media_dvd_plus_r_dl\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_r_dl = 1; + break; + case 0x40: + info(udev, "profile 0x%02x media_bd\n", cur_profile); + cd_media = 1; + cd_media_bd = 1; + break; + case 0x41: + case 0x42: + info(udev, "profile 0x%02x media_bd_r\n", cur_profile); + cd_media = 1; + cd_media_bd_r = 1; + break; + case 0x43: + info(udev, "profile 0x%02x media_bd_re\n", cur_profile); + cd_media = 1; + cd_media_bd_re = 1; + break; + case 0x50: + info(udev, "profile 0x%02x media_hddvd\n", cur_profile); + cd_media = 1; + cd_media_hddvd = 1; + break; + case 0x51: + info(udev, "profile 0x%02x media_hddvd_r\n", cur_profile); + cd_media = 1; + cd_media_hddvd_r = 1; + break; + case 0x52: + info(udev, "profile 0x%02x media_hddvd_rw\n", cur_profile); + cd_media = 1; + cd_media_hddvd_rw = 1; + break; + default: + info(udev, "profile 0x%02x \n", cur_profile); + break; + } +} + static int feature_profiles(struct udev *udev, const unsigned char *profiles, size_t size) { unsigned int i; @@ -350,6 +495,7 @@ static int feature_profiles(struct udev *udev, const unsigned char *profiles, si return 0; } +/* returns 0 if media was detected */ static int cd_profiles_old_mmc(struct udev *udev, int fd) { struct scsi_cmd sc; @@ -357,7 +503,7 @@ static int cd_profiles_old_mmc(struct udev *udev, int fd) unsigned char header[32]; - scsi_cmd_init(udev, &sc, header, sizeof(header)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x51); scsi_cmd_set(udev, &sc, 8, sizeof(header)); scsi_cmd_set(udev, &sc, 9, 0); @@ -389,6 +535,7 @@ static int cd_profiles_old_mmc(struct udev *udev, int fd) return 0; } +/* returns 0 if media was detected */ static int cd_profiles(struct udev *udev, int fd) { struct scsi_cmd sc; @@ -397,9 +544,12 @@ static int cd_profiles(struct udev *udev, int fd) unsigned int len; unsigned int i; int err; + int ret; + + ret = -1; /* First query the current profile */ - scsi_cmd_init(udev, &sc, features, sizeof(features)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x46); scsi_cmd_set(udev, &sc, 8, 8); scsi_cmd_set(udev, &sc, 9, 0); @@ -410,126 +560,20 @@ static int cd_profiles(struct udev *udev, int fd) if (SK(err) == 0x5 && ASC(err) == 0x20) { info(udev, "drive is pre-MMC2 and does not support 46h get configuration command\n"); info(udev, "trying to work around the problem\n"); - return cd_profiles_old_mmc(udev, fd); + ret = cd_profiles_old_mmc(udev, fd); } - return -1; + goto out; } cur_profile = features[6] << 8 | features[7]; if (cur_profile > 0) { info(udev, "current profile 0x%02x\n", cur_profile); + feature_profile_media (udev, cur_profile); + ret = 0; /* we have media */ } else { info(udev, "no current profile, assuming no media\n"); - return -1; } - switch (cur_profile) { - case 0x03: - case 0x04: - case 0x05: - info(udev, "profile 0x%02x \n", cur_profile); - cd_media = 1; - cd_media_mo = 1; - break; - case 0x08: - info(udev, "profile 0x%02x media_cd_rom\n", cur_profile); - cd_media = 1; - cd_media_cd_rom = 1; - break; - case 0x09: - info(udev, "profile 0x%02x media_cd_r\n", cur_profile); - cd_media = 1; - cd_media_cd_r = 1; - break; - case 0x0a: - info(udev, "profile 0x%02x media_cd_rw\n", cur_profile); - cd_media = 1; - cd_media_cd_rw = 1; - break; - case 0x10: - info(udev, "profile 0x%02x media_dvd_ro\n", cur_profile); - cd_media = 1; - cd_media_dvd_rom = 1; - break; - case 0x11: - info(udev, "profile 0x%02x media_dvd_r\n", cur_profile); - cd_media = 1; - cd_media_dvd_r = 1; - break; - case 0x12: - info(udev, "profile 0x%02x media_dvd_ram\n", cur_profile); - cd_media = 1; - cd_media_dvd_ram = 1; - break; - case 0x13: - info(udev, "profile 0x%02x media_dvd_rw_ro\n", cur_profile); - cd_media = 1; - cd_media_dvd_rw = 1; - cd_media_dvd_rw_ro = 1; - break; - case 0x14: - info(udev, "profile 0x%02x media_dvd_rw_seq\n", cur_profile); - cd_media = 1; - cd_media_dvd_rw = 1; - cd_media_dvd_rw_seq = 1; - break; - case 0x1B: - info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_r = 1; - break; - case 0x1A: - info(udev, "profile 0x%02x media_dvd_plus_rw\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_rw = 1; - break; - case 0x2A: - info(udev, "profile 0x%02x media_dvd_plus_rw_dl\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_rw_dl = 1; - break; - case 0x2B: - info(udev, "profile 0x%02x media_dvd_plus_r_dl\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_r_dl = 1; - break; - case 0x40: - info(udev, "profile 0x%02x media_bd\n", cur_profile); - cd_media = 1; - cd_media_bd = 1; - break; - case 0x41: - case 0x42: - info(udev, "profile 0x%02x media_bd_r\n", cur_profile); - cd_media = 1; - cd_media_bd_r = 1; - break; - case 0x43: - info(udev, "profile 0x%02x media_bd_re\n", cur_profile); - cd_media = 1; - cd_media_bd_re = 1; - break; - case 0x50: - info(udev, "profile 0x%02x media_hddvd\n", cur_profile); - cd_media = 1; - cd_media_hddvd = 1; - break; - case 0x51: - info(udev, "profile 0x%02x media_hddvd_r\n", cur_profile); - cd_media = 1; - cd_media_hddvd_r = 1; - break; - case 0x52: - info(udev, "profile 0x%02x media_hddvd_rw\n", cur_profile); - cd_media = 1; - cd_media_hddvd_rw = 1; - break; - default: - info(udev, "profile 0x%02x \n", cur_profile); - break; - } - - len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); @@ -541,7 +585,7 @@ static int cd_profiles(struct udev *udev, int fd) } /* Now get the full feature buffer */ - scsi_cmd_init(udev, &sc, features, len); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x46); scsi_cmd_set(udev, &sc, 7, ( len >> 8 ) & 0xff); scsi_cmd_set(udev, &sc, 8, len & 0xff); @@ -577,8 +621,8 @@ static int cd_profiles(struct udev *udev, int fd) break; } } - - return 0; +out: + return ret; } static int cd_media_info(struct udev *udev, int fd) @@ -593,7 +637,7 @@ static int cd_media_info(struct udev *udev, int fd) }; int err; - scsi_cmd_init(udev, &sc, header, sizeof(header)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x51); scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); scsi_cmd_set(udev, &sc, 9, 0); @@ -631,7 +675,7 @@ static int cd_media_info(struct udev *udev, int fd) unsigned char dvdstruct[8]; unsigned char format[12]; - scsi_cmd_init(udev, &sc, dvdstruct, sizeof(dvdstruct)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0xAD); scsi_cmd_set(udev, &sc, 7, 0xC0); scsi_cmd_set(udev, &sc, 9, sizeof(dvdstruct)); @@ -648,7 +692,7 @@ static int cd_media_info(struct udev *udev, int fd) } /* let's make sure we don't try to read unformatted media */ - scsi_cmd_init(udev, &sc, format, sizeof(format)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x23); scsi_cmd_set(udev, &sc, 8, sizeof(format)); scsi_cmd_set(udev, &sc, 9, 0); @@ -689,7 +733,7 @@ static int cd_media_info(struct udev *udev, int fd) * has "blank" status", DVD-RAM was examined earlier) and check * for ISO and UDF PVDs or a fs superblock presence and do it * in one ioctl (we need just sectors 0 and 16) */ - scsi_cmd_init(udev, &sc, buffer, sizeof(buffer)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x28); scsi_cmd_set(udev, &sc, 5, 0); scsi_cmd_set(udev, &sc, 8, 32); @@ -737,12 +781,12 @@ static int cd_media_toc(struct udev *udev, int fd) { struct scsi_cmd sc; unsigned char header[12]; - unsigned char toc[2048]; + unsigned char toc[65536]; unsigned int len, i, num_tracks; unsigned char *p; int err; - scsi_cmd_init(udev, &sc, header, sizeof(header)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 6, 1); scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); @@ -766,7 +810,7 @@ static int cd_media_toc(struct udev *udev, int fd) if (len < 8) return 0; - scsi_cmd_init(udev, &sc, toc, sizeof(toc)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ scsi_cmd_set(udev, &sc, 7, (len >> 8) & 0xff); @@ -797,7 +841,7 @@ static int cd_media_toc(struct udev *udev, int fd) cd_media_track_count_audio++; } - scsi_cmd_init(udev, &sc, header, sizeof(header)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ scsi_cmd_set(udev, &sc, 8, sizeof(header)); @@ -817,13 +861,17 @@ int main(int argc, char *argv[]) { struct udev *udev; static const struct option options[] = { - { "export", no_argument, NULL, 'x' }, + { "lock-media", no_argument, NULL, 'l' }, + { "unlock-media", no_argument, NULL, 'u' }, + { "eject-media", no_argument, NULL, 'e' }, { "debug", no_argument, NULL, 'd' }, { "help", no_argument, NULL, 'h' }, {} }; + bool eject = false; + bool lock = false; + bool unlock = false; const char *node = NULL; - int export = 0; int fd = -1; int cnt; int rc = 0; @@ -838,22 +886,30 @@ int main(int argc, char *argv[]) while (1) { int option; - option = getopt_long(argc, argv, "dxh", options, NULL); + option = getopt_long(argc, argv, "deluh", options, NULL); if (option == -1) break; switch (option) { + case 'l': + lock = true; + break; + case 'u': + unlock = true; + break; + case 'e': + eject = true; + break; case 'd': - debug = 1; + debug = true; if (udev_get_log_priority(udev) < LOG_INFO) udev_set_log_priority(udev, LOG_INFO); break; - case 'x': - export = 1; - break; case 'h': printf("Usage: cdrom_id [options] \n" - " --export export key/value pairs\n" + " --lock-media lock the media (to enable eject request events)\n" + " --unlock-media unlock the media\n" + " --eject-media eject the media\n" " --debug debug to stderr\n" " --help print this help text\n\n"); goto exit; @@ -902,11 +958,13 @@ int main(int argc, char *argv[]) /* check if drive talks MMC */ if (cd_inquiry(udev, fd) < 0) - goto print; + goto work; /* read drive and possibly current profile */ - if (cd_profiles(udev, fd) < 0) - goto print; + if (cd_profiles(udev, fd) != 0) + goto work; + + /* at this point we are guaranteed to have media in the drive - find out more about it */ /* get session/track info */ cd_media_toc(udev, fd); @@ -914,7 +972,25 @@ int main(int argc, char *argv[]) /* get writable media state */ cd_media_info(udev, fd); -print: +work: + /* lock the media, so we enable eject button events */ + if (lock && cd_media) { + info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (lock)\n"); + media_lock(udev, fd, true); + } + + if (unlock && cd_media) { + info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n"); + media_lock(udev, fd, false); + } + + if (eject) { + info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n"); + media_lock(udev, fd, false); + info(udev, "START_STOP_UNIT (eject)\n"); + media_eject(udev, fd); + } + printf("ID_CDROM=1\n"); if (cd_cd_rom) printf("ID_CDROM_CD=1\n"); @@ -1021,4 +1097,3 @@ exit: udev_log_close(); return rc; } - diff --git a/extras/collect/collect.c b/extras/collect/collect.c index 0069dea..f78f3b7 100644 --- a/extras/collect/collect.c +++ b/extras/collect/collect.c @@ -34,7 +34,6 @@ #include "libudev.h" #include "libudev-private.h" -#define TMPFILE "/dev/.udev/collect" #define BUFSIZE 16 #define UDEV_ALARM_TIMEOUT 180 @@ -338,6 +337,7 @@ static void everybody(void) int main(int argc, char **argv) { + struct udev *udev; static const struct option options[] = { { "add", no_argument, NULL, 'a' }, { "remove", no_argument, NULL, 'r' }, @@ -349,8 +349,15 @@ int main(int argc, char **argv) char *checkpoint, *us; int fd; int i; - int ret = 0; + int ret = EXIT_SUCCESS; int prune = 0; + char tmpdir[UTIL_PATH_SIZE]; + + udev = udev_new(); + if (udev == NULL) { + ret = EXIT_FAILURE; + goto exit; + } while (1) { int option; @@ -393,12 +400,13 @@ int main(int argc, char **argv) goto exit; } - udev_list_init(&bunch); + udev_list_node_init(&bunch); if (debug) fprintf(stderr, "Using checkpoint '%s'\n", checkpoint); - fd = prepare(TMPFILE, checkpoint); + util_strscpyl(tmpdir, sizeof(tmpdir), udev_get_run_path(udev), "/collect", NULL); + fd = prepare(tmpdir, checkpoint); if (fd < 0) { ret = 3; goto out; @@ -454,11 +462,12 @@ int main(int argc, char **argv) lockf(fd, F_ULOCK, 0); close(fd); - out: +out: if (debug) everybody(); if (ret >= 0) printf("COLLECT_%s=%d\n", checkpoint, ret); - exit: +exit: + udev_unref(udev); return ret; } diff --git a/extras/firmware/firmware.c b/extras/firmware/firmware.c index 76593ba..36ce790 100644 --- a/extras/firmware/firmware.c +++ b/extras/firmware/firmware.c @@ -43,7 +43,7 @@ static bool set_loading(struct udev *udev, char *loadpath, const char *state) static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) { char *buf; - FILE *fsource, *ftarget; + FILE *fsource = NULL, *ftarget = NULL; bool ret = false; buf = malloc(size); @@ -112,8 +112,6 @@ int main(int argc, char **argv) break; case 'h': printf("Usage: firmware --firmware= --devpath= [--help]\n\n"); - default: - rc = 1; goto exit; } } @@ -147,7 +145,7 @@ int main(int argc, char **argv) } util_path_encode(firmware, fwencpath, sizeof(fwencpath)); - util_strscpyl(misspath, sizeof(misspath), udev_get_dev_path(udev), "/.udev/firmware-missing/", fwencpath, NULL); + util_strscpyl(misspath, sizeof(misspath), udev_get_run_path(udev), "/firmware-missing/", fwencpath, NULL); util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL); if (fwfile == NULL) { @@ -159,11 +157,9 @@ int main(int argc, char **argv) err = util_create_path(udev, misspath); if (err != 0 && err != -ENOENT) break; - udev_selinux_setfscreatecon(udev, misspath, S_IFLNK); err = symlink(devpath, misspath); if (err != 0) err = -errno; - udev_selinux_resetfscreatecon(udev); } while (err == -ENOENT); rc = 2; set_loading(udev, loadpath, "-1"); diff --git a/extras/fstab_import/79-fstab_import.rules b/extras/fstab_import/79-fstab_import.rules deleted file mode 100644 index 2ded7d3..0000000 --- a/extras/fstab_import/79-fstab_import.rules +++ /dev/null @@ -1,2 +0,0 @@ -ACTION!="remove", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem|other", IMPORT="fstab_import $name $links mapper/$env{DM_NAME}" - diff --git a/extras/fstab_import/fstab_import.c b/extras/fstab_import/fstab_import.c deleted file mode 100644 index c66bffb..0000000 --- a/extras/fstab_import/fstab_import.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * find matching entry in fstab and export it - * - * Copyright (C) 2008 Kay Sievers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static int debug; - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - if (debug) { - fprintf(stderr, "%s: ", fn); - vfprintf(stderr, format, args); - } else { - vsyslog(priority, format, args); - } -} - -static int matches_device_list(struct udev *udev, char **devices, const char *name) -{ - int i; - - for (i = 0; devices[i] != NULL; i++) { - info(udev, "compare '%s' == '%s'\n", name, devices[i]); - if (strcmp(devices[i], name) == 0) - return 1; - } - return 0; -} - -static void print_fstab_entry(struct udev *udev, struct mntent *mnt) -{ - printf("FSTAB_NAME=%s\n", mnt->mnt_fsname); - printf("FSTAB_DIR=%s\n", mnt->mnt_dir); - printf("FSTAB_TYPE=%s\n", mnt->mnt_type); - printf("FSTAB_OPTS=%s\n", mnt->mnt_opts); - printf("FSTAB_FREQ=%d\n", mnt->mnt_freq); - printf("FSTAB_PASSNO=%d\n", mnt->mnt_passno); -} - -int main(int argc, char *argv[]) -{ - struct udev *udev; - static const struct option options[] = { - { "export", no_argument, NULL, 'x' }, - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - char **devices; - FILE *fp; - struct mntent *mnt; - int rc = 1; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("fstab_id"); - udev_set_log_fn(udev, log_fn); - - while (1) { - int option; - - option = getopt_long(argc, argv, "dxh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'd': - debug = 1; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'h': - printf("Usage: fstab_id [OPTIONS] name [...]\n" - " --export print environment keys\n" - " --debug debug to stderr\n" - " --help print this help text\n\n"); - goto exit; - case 'x': - break; - default: - rc = 2; - goto exit; - } - } - - devices = &argv[optind]; - if (devices[0] == NULL) { - fprintf(stderr, "error: missing device(s) to match\n"); - rc = 3; - goto exit; - } - - fp = setmntent ("/etc/fstab", "r"); - if (fp == NULL) { - fprintf(stderr, "error: opening fstab: %s\n", strerror(errno)); - rc = 4; - goto exit; - } - - while (1) { - mnt = getmntent(fp); - if (mnt == NULL) - break; - - info(udev, "found '%s'@'%s'\n", mnt->mnt_fsname, mnt->mnt_dir); - - /* skip root device */ - if (strcmp(mnt->mnt_dir, "/") == 0) - continue; - - /* match LABEL */ - if (strncmp(mnt->mnt_fsname, "LABEL=", 6) == 0) { - const char *label; - char str[256]; - - label = &mnt->mnt_fsname[6]; - if (label[0] == '"' || label[0] == '\'') { - char *pos; - - util_strscpy(str, sizeof(str), &label[1]); - pos = strrchr(str, label[0]); - if (pos == NULL) - continue; - pos[0] = '\0'; - label = str; - } - if (matches_device_list(udev, devices, label)) { - print_fstab_entry(udev, mnt); - rc = 0; - break; - } - continue; - } - - /* match UUID */ - if (strncmp(mnt->mnt_fsname, "UUID=", 5) == 0) { - const char *uuid; - char str[256]; - - uuid = &mnt->mnt_fsname[5]; - if (uuid[0] == '"' || uuid[0] == '\'') { - char *pos; - - util_strscpy(str, sizeof(str), &uuid[1]); - pos = strrchr(str, uuid[0]); - if (pos == NULL) - continue; - pos[0] = '\0'; - uuid = str; - } - if (matches_device_list(udev, devices, uuid)) { - print_fstab_entry(udev, mnt); - rc = 0; - break; - } - continue; - } - - /* only devices */ - if (strncmp(mnt->mnt_fsname, udev_get_dev_path(udev), strlen(udev_get_dev_path(udev))) != 0) - continue; - - if (matches_device_list(udev, devices, &mnt->mnt_fsname[strlen(udev_get_dev_path(udev))+1])) { - print_fstab_entry(udev, mnt); - rc = 0; - break; - } - } - endmntent(fp); - -exit: - udev_unref(udev); - udev_log_close(); - return rc; -} diff --git a/extras/gudev/docs/Makefile.in b/extras/gudev/docs/Makefile.in index c8dde58..a86e00f 100644 --- a/extras/gudev/docs/Makefile.in +++ b/extras/gudev/docs/Makefile.in @@ -78,6 +78,7 @@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -94,6 +95,8 @@ GLIB_LIBS = @GLIB_LIBS@ GPERF = @GPERF@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ G_IR_COMPILER = @G_IR_COMPILER@ @@ -113,12 +116,11 @@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ -LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -153,6 +155,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -185,7 +188,6 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -291,10 +293,10 @@ GTKDOC_LIBS = \ $(GLIB_LIBS) \ $(top_builddir)/extras/gudev/libgudev-1.0.la -@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) +@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) +@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) @GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_RUN = @GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_RUN = $(LIBTOOL) --mode=execute @@ -305,18 +307,21 @@ GTKDOC_LIBS = \ # GPATH = $(srcdir) TARGET_DIR = $(HTML_DIR)/$(DOC_MODULE) +SETUP_FILES = \ + $(content_files) \ + $(DOC_MAIN_SGML_FILE) \ + $(DOC_MODULE)-sections.txt \ + $(DOC_MODULE)-overrides.txt + # This includes the standard gtk-doc make rules, copied by gtkdocize. # Other files to distribute # e.g. EXTRA_DIST += version.xml.in -EXTRA_DIST = $(content_files) $(HTML_IMAGES) $(DOC_MAIN_SGML_FILE) \ - $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt \ - version.xml.in -DOC_STAMPS = scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \ - pdf-build.stamp \ - $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp \ - $(srcdir)/pdf.stamp +EXTRA_DIST = $(HTML_IMAGES) $(SETUP_FILES) version.xml.in +DOC_STAMPS = setup-build.stamp scan-build.stamp tmpl-build.stamp sgml-build.stamp \ + html-build.stamp pdf-build.stamp \ + tmpl.stamp sgml.stamp html.stamp pdf.stamp SCANOBJ_FILES = \ $(DOC_MODULE).args \ @@ -537,22 +542,47 @@ docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) $(REPORT_FILES): sgml-build.stamp +#### setup #### + +setup-build.stamp: + -@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ + echo ' DOC Preparing build'; \ + files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \ + if test "x$$files" != "x" ; then \ + for file in $$files ; do \ + test -f $(abs_srcdir)/$$file && \ + cp -pu $(abs_srcdir)/$$file $(abs_builddir)/ || true; \ + done; \ + fi; \ + test -d $(abs_srcdir)/tmpl && \ + { cp -rp $(abs_srcdir)/tmpl $(abs_builddir)/; \ + chmod -R u+w $(abs_builddir)/tmpl; } \ + fi + @touch setup-build.stamp + #### scan #### scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) - @echo 'gtk-doc: Scanning header files' - @-chmod -R u+w $(srcdir) - @_source_dir='' ; for i in $(DOC_SOURCE_DIR) ; do \ + @echo ' DOC Scanning header files' + @_source_dir='' ; \ + for i in $(DOC_SOURCE_DIR) ; do \ _source_dir="$${_source_dir} --source-dir=$$i" ; \ - done ; \ - cd $(srcdir) && \ - gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES) - @if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \ - CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \ + done ; \ + gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES) + @if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \ + echo " DOC Introspecting gobjects"; \ + scanobj_options=""; \ + gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \ + if test "$(?)" = "0"; then \ + if test "x$(V)" = "x1"; then \ + scanobj_options="--verbose"; \ + fi; \ + fi; \ + CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \ + gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \ else \ - cd $(srcdir) ; \ for i in $(SCANOBJ_FILES) ; do \ - test -f $$i || touch $$i ; \ + test -f $$i || touch $$i ; \ done \ fi @touch scan-build.stamp @@ -562,10 +592,14 @@ $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE) #### templates #### -tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt - @echo 'gtk-doc: Rebuilding template files' - @-chmod -R u+w $(srcdir) - @cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS) +tmpl-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt + @echo ' DOC Rebuilding template files' + @gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS) + @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ + if test -w $(abs_srcdir) ; then \ + cp -rp $(abs_builddir)/tmpl $(abs_srcdir)/; \ + fi \ + fi @touch tmpl-build.stamp tmpl.stamp: tmpl-build.stamp @@ -577,13 +611,13 @@ $(srcdir)/tmpl/*.sgml: #### xml #### sgml-build.stamp: tmpl.stamp $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files) - @echo 'gtk-doc: Building XML' + @echo ' DOC Building XML' @-chmod -R u+w $(srcdir) - @_source_dir='' ; for i in $(DOC_SOURCE_DIR) ; do \ + @_source_dir='' ; \ + for i in $(DOC_SOURCE_DIR) ; do \ _source_dir="$${_source_dir} --source-dir=$$i" ; \ - done ; \ - cd $(srcdir) && \ - gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS) + done ; \ + gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS) @touch sgml-build.stamp sgml.stamp: sgml-build.stamp @@ -592,58 +626,79 @@ sgml.stamp: sgml-build.stamp #### html #### html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) - @echo 'gtk-doc: Building HTML' - @-chmod -R u+w $(srcdir) - @rm -rf $(srcdir)/html - @mkdir $(srcdir)/html + @echo ' DOC Building HTML' + @rm -rf html + @mkdir html @mkhtml_options=""; \ + gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \ + if test "$(?)" = "0"; then \ + if test "x$(V)" = "x1"; then \ + mkhtml_options="$$mkhtml_options --verbose"; \ + fi; \ + fi; \ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \ if test "$(?)" = "0"; then \ - mkhtml_options=--path="$(srcdir)"; \ + mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \ fi; \ - cd $(srcdir)/html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) - @test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html ) - @echo 'gtk-doc: Fixing cross-references' - @cd $(srcdir) && gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) + cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) + -@test "x$(HTML_IMAGES)" = "x" || \ + for file in $(HTML_IMAGES) ; do \ + if test -f $(abs_srcdir)/$$file ; then \ + cp $(abs_srcdir)/$$file $(abs_builddir)/html; \ + fi; \ + if test -f $(abs_builddir)/$$file ; then \ + cp $(abs_builddir)/$$file $(abs_builddir)/html; \ + fi; \ + done; + @echo ' DOC Fixing cross-references' + @gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) @touch html-build.stamp #### pdf #### pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) - @echo 'gtk-doc: Building PDF' - @-chmod -R u+w $(srcdir) - @rm -rf $(srcdir)/$(DOC_MODULE).pdf - @mkpdf_imgdirs=""; \ + @echo ' DOC Building PDF' + @rm -f $(DOC_MODULE).pdf + @mkpdf_options=""; \ + gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \ + if test "$(?)" = "0"; then \ + if test "x$(V)" = "x1"; then \ + mkpdf_options="$$mkpdf_options --verbose"; \ + fi; \ + fi; \ if test "x$(HTML_IMAGES)" != "x"; then \ for img in $(HTML_IMAGES); do \ part=`dirname $$img`; \ - echo $$mkpdf_imgdirs | grep >/dev/null "\-\-imgdir=$$part "; \ + echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \ if test $$? != 0; then \ - mkpdf_imgdirs="$$mkpdf_imgdirs --imgdir=$$part"; \ + mkpdf_options="$$mkpdf_options --imgdir=$$part"; \ fi; \ done; \ fi; \ - cd $(srcdir) && gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_imgdirs $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS) + gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS) @touch pdf-build.stamp ############## clean-local: - rm -f *~ *.bak - rm -rf .libs + @rm -f *~ *.bak + @rm -rf .libs distclean-local: - cd $(srcdir) && \ - rm -rf xml $(REPORT_FILES) $(DOC_MODULE).pdf \ - $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt + @rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \ + $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt + @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ + rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \ + rm -rf tmpl; \ + fi maintainer-clean-local: clean - cd $(srcdir) && rm -rf xml html + @rm -rf xml html install-data-local: - @installfiles=`echo $(srcdir)/html/*`; \ - if test "$$installfiles" = '$(srcdir)/html/*'; \ - then echo '-- Nothing to install' ; \ + @installfiles=`echo $(builddir)/html/*`; \ + if test "$$installfiles" = '$(builddir)/html/*'; \ + then echo 1>&2 'Nothing to install' ; \ else \ if test -n "$(DOC_MODULE_VERSION)"; then \ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ @@ -652,14 +707,12 @@ install-data-local: fi; \ $(mkinstalldirs) $${installdir} ; \ for i in $$installfiles; do \ - echo '-- Installing '$$i ; \ + echo ' $(INSTALL_DATA) '$$i ; \ $(INSTALL_DATA) $$i $${installdir}; \ done; \ if test -n "$(DOC_MODULE_VERSION)"; then \ mv -f $${installdir}/$(DOC_MODULE).devhelp2 \ $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \ - mv -f $${installdir}/$(DOC_MODULE).devhelp \ - $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp; \ fi; \ $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \ fi @@ -681,15 +734,15 @@ uninstall-local: @ENABLE_GTK_DOC_FALSE@ @false dist-hook: dist-check-gtkdoc dist-hook-local - mkdir $(distdir)/tmpl - mkdir $(distdir)/html - -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl - cp $(srcdir)/html/* $(distdir)/html - -cp $(srcdir)/$(DOC_MODULE).pdf $(distdir)/ - -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/ - -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/ - cd $(distdir) && rm -f $(DISTCLEANFILES) - $(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html + @mkdir $(distdir)/tmpl + @mkdir $(distdir)/html + @-cp ./tmpl/*.sgml $(distdir)/tmpl + @cp ./html/* $(distdir)/html + @-cp ./$(DOC_MODULE).pdf $(distdir)/ + @-cp ./$(DOC_MODULE).types $(distdir)/ + @-cp ./$(DOC_MODULE)-sections.txt $(distdir)/ + @cd $(distdir) && rm -f $(DISTCLEANFILES) + @$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html .PHONY : dist-hook-local docs diff --git a/extras/gudev/docs/gudev-docs.xml b/extras/gudev/docs/gudev-docs.xml index 3a93b21..65fdfff 100644 --- a/extras/gudev/docs/gudev-docs.xml +++ b/extras/gudev/docs/gudev-docs.xml @@ -29,7 +29,7 @@ - 2009 + 2011 The GUDev Authors diff --git a/extras/gudev/docs/gudev-sections.txt b/extras/gudev/docs/gudev-sections.txt index 181870f..213e1a7 100644 --- a/extras/gudev/docs/gudev-sections.txt +++ b/extras/gudev/docs/gudev-sections.txt @@ -19,6 +19,8 @@ g_udev_client_get_type G_UDEV_CLIENT_CLASS G_UDEV_IS_CLIENT_CLASS G_UDEV_CLIENT_GET_CLASS + +GUdevClientPrivate
@@ -65,6 +67,8 @@ g_udev_device_get_type G_UDEV_DEVICE_CLASS G_UDEV_IS_DEVICE_CLASS G_UDEV_DEVICE_GET_CLASS + +GUdevDevicePrivate
@@ -91,4 +95,19 @@ g_udev_enumerator_get_type G_UDEV_ENUMERATOR_CLASS G_UDEV_IS_ENUMERATOR_CLASS G_UDEV_ENUMERATOR_GET_CLASS + +GUdevEnumeratorPrivate +
+ +
+gudevmarshal + +g_udev_marshal_VOID__STRING_OBJECT +
+ +
+gudevenumtypes + +G_TYPE_UDEV_DEVICE_TYPE +g_udev_device_type_get_type
diff --git a/extras/gudev/docs/html/GUdevClient.html b/extras/gudev/docs/html/GUdevClient.html index ae5c646..09aba95 100644 --- a/extras/gudev/docs/html/GUdevClient.html +++ b/extras/gudev/docs/html/GUdevClient.html @@ -3,12 +3,12 @@ GUdevClient - + - + @@ -32,7 +32,7 @@ Signals -
+
@@ -41,18 +41,18 @@
-
+

Synopsis

-
                    GUdevClient;
-                    GUdevClientClass;
-enum                GUdevDeviceType;
+
                    GUdevClient;
+struct              GUdevClientClass;
+enum                GUdevDeviceType;
 typedef             GUdevDeviceNumber;
 GUdevClient *       g_udev_client_new                   (const gchar * const *subsystems);
 GList *             g_udev_client_query_by_subsystem    (GUdevClient *client,
                                                          const gchar *subsystem);
 GUdevDevice *       g_udev_client_query_by_device_number
                                                         (GUdevClient *client,
-                                                         GUdevDeviceType type,
+                                                         GUdevDeviceType type,
                                                          GUdevDeviceNumber number);
 GUdevDevice *       g_udev_client_query_by_device_file  (GUdevClient *client,
                                                          const gchar *device_file);
@@ -64,26 +64,30 @@ typedef             const gchar *name);
 
-
+

Object Hierarchy

   GObject
    +----GUdevClient
 
+
+  GEnum
+   +----GUdevDeviceType
+
-
+

Properties

-  "subsystems"               GStrv*                : Read / Write / Construct Only
+  "subsystems"               GStrv                 : Read / Write / Construct Only
 
-
+

Signals

-  "uevent"                                         : Run Last
+  "uevent"                                         : Run Last
 
-
+

Description

GUdevClient is used to query information about devices on a Linux @@ -112,30 +116,26 @@ or the "uevent" signal.

-
+

Details

-
+

GUdevClient

typedef struct _GUdevClient GUdevClient;

The GUdevClient struct is opaque and should not be accessed directly.

-
-- -

-
-

GUdevClientClass

-
typedef struct {
+
+

struct GUdevClientClass

+
struct GUdevClientClass {
   GObjectClass   parent_class;
 
   /* signals */
   void (*uevent) (GUdevClient  *client,
                   const gchar  *action,
                   GUdevDevice  *device);
-} GUdevClientClass;
+};
 

Class structure for GUdevClient. @@ -145,22 +145,19 @@ Class structure for

GObjectClass parent_class;

-Parent class. - +Parent class.

uevent ()

-Signal class handler for the "uevent" signal. - +Signal class handler for the "uevent" signal.

-
-

enum GUdevDeviceType

-
typedef enum
-{
+
+

enum GUdevDeviceType

+
typedef enum {
   G_UDEV_DEVICE_TYPE_NONE = 0,
   G_UDEV_DEVICE_TYPE_BLOCK = 'b',
   G_UDEV_DEVICE_TYPE_CHAR = 'c',
@@ -191,15 +188,17 @@ Enumeration used to specify a the type of a device.
 

-
+

GUdevDeviceNumber

+
typedef guint64 GUdevDeviceNumber; /* __UQUAD_TYPE */
+

Corresponds to the standard dev_t type as defined by POSIX (Until bug 584517 is resolved this work-around is needed).


-
+

g_udev_client_new ()

GUdevClient *       g_udev_client_new                   (const gchar * const *subsystems);

@@ -214,19 +213,18 @@ of the thread that you call this constructor from.

subsystems :

- A NULL terminated string array of subsystems to listen for uevents on, NULL to not listen on uevents at all, or an empty array to listen to uevents on all subsystems. See the documentation for the "subsystems" property for details on this parameter. [array zero-terminated=1][element-type utf8][transfer none utf8][allow-none utf8] +A NULL terminated string array of subsystems to listen for uevents on, NULL to not listen on uevents at all, or an empty array to listen to uevents on all subsystems. See the documentation for the "subsystems" property for details on this parameter. [array zero-terminated=1][element-type utf8][transfer none][allow-none]

Returns :

- A new GUdevClient object. Free with g_object_unref(). - +A new GUdevClient object. Free with g_object_unref().

-
+

g_udev_client_query_by_subsystem ()

GList *             g_udev_client_query_by_subsystem    (GUdevClient *client,
                                                          const gchar *subsystem);
@@ -238,28 +236,27 @@ Gets all devices belonging to subsystem.

client :

-A GUdevClient. - +A GUdevClient.

subsystem :

- The subsystem to get devices for or NULL to get all devices. [allow-none] +The subsystem to get devices for or NULL to get all devices. [allow-none]

Returns :

- A list of GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. [element-type GUdevDevice][transfer full GUdevDevice] +A list of GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. [element-type GUdevDevice][transfer full]

-
+

g_udev_client_query_by_device_number ()

GUdevDevice *       g_udev_client_query_by_device_number
                                                         (GUdevClient *client,
-                                                         GUdevDeviceType type,
+                                                         GUdevDeviceType type,
                                                          GUdevDeviceNumber number);

Looks up a device for a type and device number. @@ -269,29 +266,26 @@ Looks up a device for a type and device number.

client :

-A GUdevClient. - +A GUdevClient.

type :

-A value from the GUdevDeviceType enumeration. - +A value from the GUdevDeviceType enumeration.

number :

-A device number. - +A device number.

Returns :

- A GUdevDevice object or NULL if the device was not found. Free with g_object_unref(). [transfer full] +A GUdevDevice object or NULL if the device was not found. Free with g_object_unref(). [transfer full]

-
+

g_udev_client_query_by_device_file ()

GUdevDevice *       g_udev_client_query_by_device_file  (GUdevClient *client,
                                                          const gchar *device_file);
@@ -303,24 +297,22 @@ Looks up a device for a device file.

client :

-A GUdevClient. - +A GUdevClient.

device_file :

-A device file. - +A device file.

Returns :

- A GUdevDevice object or NULL if the device was not found. Free with g_object_unref(). [transfer full] +A GUdevDevice object or NULL if the device was not found. Free with g_object_unref(). [transfer full]

-
+

g_udev_client_query_by_sysfs_path ()

GUdevDevice *       g_udev_client_query_by_sysfs_path   (GUdevClient *client,
                                                          const gchar *sysfs_path);
@@ -332,24 +324,22 @@ Looks up a device for a sysfs path.

client :

-A GUdevClient. - +A GUdevClient.

sysfs_path :

-A sysfs path. - +A sysfs path.

Returns :

- +A GUdevDevice object or NULL if the device was not found. Free with g_object_unref(). [transfer full]

-
+

g_udev_client_query_by_subsystem_and_name ()

GUdevDevice *       g_udev_client_query_by_subsystem_and_name
                                                         (GUdevClient *client,
@@ -363,33 +353,30 @@ Looks up a device for a subsystem and name.
 
 
 

client :

-A GUdevClient. - +A GUdevClient.

subsystem :

-A subsystem name. - +A subsystem name.

name :

-The name of the device. - +The name of the device.

Returns :

- A GUdevDevice object or NULL if the device was not found. Free with g_object_unref(). [transfer full] +A GUdevDevice object or NULL if the device was not found. Free with g_object_unref(). [transfer full]
-
+

Property Details

-
+

The "subsystems" property

-
  "subsystems"               GStrv*                : Read / Write / Construct Only
+
  "subsystems"               GStrv                 : Read / Write / Construct Only

The subsystems to listen for uevents on.

@@ -406,14 +393,14 @@ reported.

-
+

Signal Details

-
+

The "uevent" signal

void                user_function                      (GUdevClient *client,
                                                         gchar       *action,
                                                         GUdevDevice *device,
-                                                        gpointer     user_data)      : Run Last
+ gpointer user_data) : Run Last

Emitted when client receives an uevent.

@@ -427,18 +414,15 @@ of the thread that client was created in

client :

-The GUdevClient receiving the event. - +The GUdevClient receiving the event.

action :

-The action for the uevent e.g. "add", "remove", "change", "move", etc. - +The action for the uevent e.g. "add", "remove", "change", "move", etc.

device :

-Details about the GUdevDevice the event is for. - +Details about the GUdevDevice the event is for.

user_data :

@@ -451,6 +435,6 @@ of the thread that client was created in
+ Generated by GTK-Doc V1.18
\ No newline at end of file diff --git a/extras/gudev/docs/html/GUdevDevice.html b/extras/gudev/docs/html/GUdevDevice.html index b547df2..e9593d2 100644 --- a/extras/gudev/docs/html/GUdevDevice.html +++ b/extras/gudev/docs/html/GUdevDevice.html @@ -3,12 +3,12 @@ GUdevDevice - + - + @@ -28,7 +28,7 @@ Object Hierarchy -
+
@@ -37,10 +37,10 @@
-
+

Synopsis

                    GUdevDevice;
-                    GUdevDeviceClass;
+struct              GUdevDeviceClass;
 const gchar *       g_udev_device_get_subsystem         (GUdevDevice *device);
 const gchar *       g_udev_device_get_devtype           (GUdevDevice *device);
 const gchar *       g_udev_device_get_name              (GUdevDevice *device);
@@ -49,21 +49,21 @@ const gchar *       g_udev_device_get_driver            (GUdevDevice *device);
 const gchar *       g_udev_device_get_action            (GUdevDevice *device);
 guint64             g_udev_device_get_seqnum            (GUdevDevice *device);
-GUdevDeviceType     g_udev_device_get_device_type       (GUdevDevice *device);
+GUdevDeviceType     g_udev_device_get_device_type       (GUdevDevice *device);
 GUdevDeviceNumber   g_udev_device_get_device_number     (GUdevDevice *device);
 const gchar *       g_udev_device_get_device_file       (GUdevDevice *device);
-const gchar* const * g_udev_device_get_device_file_symlinks
+const gchar * const * g_udev_device_get_device_file_symlinks
                                                         (GUdevDevice *device);
 GUdevDevice *       g_udev_device_get_parent            (GUdevDevice *device);
 GUdevDevice *       g_udev_device_get_parent_with_subsystem
                                                         (GUdevDevice *device,
                                                          const gchar *subsystem,
                                                          const gchar *devtype);
-const gchar* const * g_udev_device_get_tags             (GUdevDevice *device);
+const gchar * const * g_udev_device_get_tags            (GUdevDevice *device);
 gboolean            g_udev_device_get_is_initialized    (GUdevDevice *device);
 guint64             g_udev_device_get_usec_since_initialized
                                                         (GUdevDevice *device);
-const gchar* const * g_udev_device_get_property_keys    (GUdevDevice *device);
+const gchar * const * g_udev_device_get_property_keys   (GUdevDevice *device);
 gboolean            g_udev_device_has_property          (GUdevDevice *device,
                                                          const gchar *key);
 const gchar *       g_udev_device_get_property          (GUdevDevice *device,
@@ -79,7 +79,8 @@ const gboolean            g_udev_device_get_property_as_boolean
                                                         (GUdevDevice *device,
                                                          const gchar *key);
-const gchar* const * g_udev_device_get_property_as_strv (GUdevDevice *device,
+const gchar * const * g_udev_device_get_property_as_strv
+                                                        (GUdevDevice *device,
                                                          const gchar *key);
 const gchar *       g_udev_device_get_sysfs_attr        (GUdevDevice *device,
                                                          const gchar *name);
@@ -94,19 +95,19 @@ const gboolean            g_udev_device_get_sysfs_attr_as_boolean
                                                         (GUdevDevice *device,
                                                          const gchar *name);
-const gchar* const * g_udev_device_get_sysfs_attr_as_strv
+const gchar * const * g_udev_device_get_sysfs_attr_as_strv
                                                         (GUdevDevice *device,
                                                          const gchar *name);
 
-
+

Object Hierarchy

   GObject
    +----GUdevDevice
 
-
+

Description

The GUdevDevice class is used to get information about a specific @@ -161,25 +162,21 @@ the device. Do not free this string, it is owned by device. - +The value for key or NULL if key doesn't exist on device. Do not free this string, it is owned by device.


-
+

g_udev_device_get_property_as_int ()

gint                g_udev_device_get_property_as_int   (GUdevDevice *device,
                                                          const gchar *key);
@@ -706,25 +661,22 @@ using strtol().

device :

-A GUdevDevice. - +A GUdevDevice.

key :

-Name of property. - +Name of property.

Returns :

- The value for key or 0 if key doesn't exist or -isn't an integer. - +The value for key or 0 if key doesn't exist or +isn't an integer.

-
+

g_udev_device_get_property_as_uint64 ()

guint64             g_udev_device_get_property_as_uint64
                                                         (GUdevDevice *device,
@@ -738,25 +690,22 @@ Look up the value for key on device :

-A GUdevDevice. - +A GUdevDevice.

key :

-Name of property. - +Name of property.

Returns :

- The value for key or 0 if key doesn't exist or isn't a -guint64. - +The value for key or 0 if key doesn't exist or isn't a +guint64.

-
+

g_udev_device_get_property_as_double ()

gdouble             g_udev_device_get_property_as_double
                                                         (GUdevDevice *device,
@@ -770,25 +719,22 @@ precision floating point number using strtod().
 
 
 

device :

-A GUdevDevice. - +A GUdevDevice.

key :

-Name of property. - +Name of property.

Returns :

- The value for key or 0.0 if key doesn't exist or isn't a -gdouble. - +The value for key or 0.0 if key doesn't exist or isn't a +gdouble.

-
+

g_udev_device_get_property_as_boolean ()

gboolean            g_udev_device_get_property_as_boolean
                                                         (GUdevDevice *device,
@@ -803,27 +749,25 @@ on the string value against "1" and "true".
 
 
 

device :

-A GUdevDevice. - +A GUdevDevice.

key :

-Name of property. - +Name of property.

Returns :

- The value for key or FALSE if key doesn't exist or -isn't a gboolean. - +The value for key or FALSE if key doesn't exist or +isn't a gboolean.

-
+

g_udev_device_get_property_as_strv ()

-
const gchar* const * g_udev_device_get_property_as_strv (GUdevDevice *device,
+
const gchar * const * g_udev_device_get_property_as_strv
+                                                        (GUdevDevice *device,
                                                          const gchar *key);

Look up the value for key on device and return the result of @@ -837,24 +781,22 @@ locale is not taken into account).

device :

-A GUdevDevice. - +A GUdevDevice.

key :

-Name of property. - +Name of property.

Returns :

- The value of key on device split into tokens or NULL if key doesn't exist. This array is owned by device and should not be freed by the caller. [transfer none][array zero-terminated=1][element-type utf8] +The value of key on device split into tokens or NULL if key doesn't exist. This array is owned by device and should not be freed by the caller. [transfer none][array zero-terminated=1][element-type utf8]

-
+

g_udev_device_get_sysfs_attr ()

const gchar *       g_udev_device_get_sysfs_attr        (GUdevDevice *device,
                                                          const gchar *name);
@@ -866,25 +808,22 @@ Look up the sysfs attribute with name on

device :

-A GUdevDevice. - +A GUdevDevice.

name :

-Name of the sysfs attribute. - +Name of the sysfs attribute.

Returns :

- The value of the sysfs attribute or NULL if there is no -such attribute. Do not free this string, it is owned by device. - +The value of the sysfs attribute or NULL if there is no +such attribute. Do not free this string, it is owned by device.

-
+

g_udev_device_get_sysfs_attr_as_int ()

gint                g_udev_device_get_sysfs_attr_as_int (GUdevDevice *device,
                                                          const gchar *name);
@@ -897,25 +836,22 @@ using strtol().

device :

-A GUdevDevice. - +A GUdevDevice.

name :

-Name of the sysfs attribute. - +Name of the sysfs attribute.

Returns :

- The value of the sysfs attribute or 0 if there is no such -attribute. - +The value of the sysfs attribute or 0 if there is no such +attribute.

-
+

g_udev_device_get_sysfs_attr_as_uint64 ()

guint64             g_udev_device_get_sysfs_attr_as_uint64
                                                         (GUdevDevice *device,
@@ -929,25 +865,22 @@ Look up the sysfs attribute with name on
 
 
 

device :

-A GUdevDevice. - +A GUdevDevice.

name :

-Name of the sysfs attribute. - +Name of the sysfs attribute.

Returns :

- The value of the sysfs attribute or 0 if there is no such -attribute. - +The value of the sysfs attribute or 0 if there is no such +attribute.

-
+

g_udev_device_get_sysfs_attr_as_double ()

gdouble             g_udev_device_get_sysfs_attr_as_double
                                                         (GUdevDevice *device,
@@ -961,25 +894,22 @@ precision floating point number using strtod().
 
 
 

device :

-A GUdevDevice. - +A GUdevDevice.

name :

-Name of the sysfs attribute. - +Name of the sysfs attribute.

Returns :

- The value of the sysfs attribute or 0.0 if there is no such -attribute. - +The value of the sysfs attribute or 0.0 if there is no such +attribute.

-
+

g_udev_device_get_sysfs_attr_as_boolean ()

gboolean            g_udev_device_get_sysfs_attr_as_boolean
                                                         (GUdevDevice *device,
@@ -994,27 +924,24 @@ on the string value against "1" and "true".
 
 
 

device :

-A GUdevDevice. - +A GUdevDevice.

name :

-Name of the sysfs attribute. - +Name of the sysfs attribute.

Returns :

- The value of the sysfs attribute or FALSE if there is no such -attribute. - +The value of the sysfs attribute or FALSE if there is no such +attribute.

-
+

g_udev_device_get_sysfs_attr_as_strv ()

-
const gchar* const * g_udev_device_get_sysfs_attr_as_strv
+
const gchar * const * g_udev_device_get_sysfs_attr_as_strv
                                                         (GUdevDevice *device,
                                                          const gchar *name);

@@ -1029,17 +956,15 @@ not taken into account).

device :

-A GUdevDevice. - +A GUdevDevice.

name :

-Name of the sysfs attribute. - +Name of the sysfs attribute.

Returns :

- The value of the sysfs attribute split into tokens or NULL if there is no such attribute. This array is owned by device and should not be freed by the caller. [transfer none][array zero-terminated=1][element-type utf8] +The value of the sysfs attribute split into tokens or NULL if there is no such attribute. This array is owned by device and should not be freed by the caller. [transfer none][array zero-terminated=1][element-type utf8] @@ -1049,6 +974,6 @@ not taken into account).
+ Generated by GTK-Doc V1.18
\ No newline at end of file diff --git a/extras/gudev/docs/html/GUdevEnumerator.html b/extras/gudev/docs/html/GUdevEnumerator.html index 46c46aa..0189708 100644 --- a/extras/gudev/docs/html/GUdevEnumerator.html +++ b/extras/gudev/docs/html/GUdevEnumerator.html @@ -3,12 +3,12 @@ GUdevEnumerator - + - + @@ -30,7 +30,7 @@ Properties -
+
@@ -39,10 +39,10 @@
-
+ -
+

Object Hierarchy

   GObject
    +----GUdevEnumerator
 
-
+

Properties

   "client"                   GUdevClient*          : Read / Write / Construct Only
 
-
+

Description

GUdevEnumerator is used to lookup and sort devices.

-
+

Details

-
+

GUdevEnumerator

typedef struct _GUdevEnumerator GUdevEnumerator;

The GUdevEnumerator struct is opaque and should not be accessed directly.

-
-- -

Since 165


-
-

GUdevEnumeratorClass

-
typedef struct {
+
+

struct GUdevEnumeratorClass

+
struct GUdevEnumeratorClass {
   GObjectClass   parent_class;
-} GUdevEnumeratorClass;
+};
 

Class structure for GUdevEnumerator. @@ -120,14 +116,13 @@ Class structure for

GObjectClass parent_class;

-Parent class. - +Parent class.

Since 165


-
+

g_udev_enumerator_new ()

GUdevEnumerator *   g_udev_enumerator_new               (GUdevClient *client);

@@ -141,21 +136,18 @@ and execute the query to get a list of devices with

client :

-A GUdevClient to enumerate devices from. - +A GUdevClient to enumerate devices from.

Returns :

- A new GUdevEnumerator object. Free with g_object_unref(). - - +A new GUdevEnumerator object. Free with g_object_unref().

Since 165


-
+

g_udev_enumerator_add_match_subsystem ()

GUdevEnumerator *   g_udev_enumerator_add_match_subsystem
                                                         (GUdevEnumerator *enumerator,
@@ -168,17 +160,15 @@ All returned devices will match the given subsystem<
 
 
 

enumerator :

-A GUdevEnumerator. - +A GUdevEnumerator.

subsystem :

-Wildcard for subsystem name e.g. 'scsi' or 'a*'. - +Wildcard for subsystem name e.g. 'scsi' or 'a*'.

Returns :

- The passed in enumerator. [transfer none] +The passed in enumerator. [transfer none] @@ -186,7 +176,7 @@ All returned devices will match the given subsystem<

Since 165


-
+

g_udev_enumerator_add_nomatch_subsystem ()

GUdevEnumerator *   g_udev_enumerator_add_nomatch_subsystem
                                                         (GUdevEnumerator *enumerator,
@@ -199,17 +189,15 @@ All returned devices will not match the given subsys
 
 
 

enumerator :

-A GUdevEnumerator. - +A GUdevEnumerator.

subsystem :

-Wildcard for subsystem name e.g. 'scsi' or 'a*'. - +Wildcard for subsystem name e.g. 'scsi' or 'a*'.

Returns :

- The passed in enumerator. [transfer none] +The passed in enumerator. [transfer none] @@ -217,7 +205,7 @@ All returned devices will not match the given subsys

Since 165


-
+

g_udev_enumerator_add_match_sysfs_attr ()

GUdevEnumerator *   g_udev_enumerator_add_match_sysfs_attr
                                                         (GUdevEnumerator *enumerator,
@@ -231,22 +219,19 @@ All returned devices will have a sysfs attribute matching the given enumerator :

-A GUdevEnumerator. - +A GUdevEnumerator.

name :

-Wildcard filter for sysfs attribute key. - +Wildcard filter for sysfs attribute key.

value :

-Wildcard filter for sysfs attribute value. - +Wildcard filter for sysfs attribute value.

Returns :

- The passed in enumerator. [transfer none] +The passed in enumerator. [transfer none] @@ -254,7 +239,7 @@ All returned devices will have a sysfs attribute matching the given Since 165


-
+

g_udev_enumerator_add_nomatch_sysfs_attr ()

GUdevEnumerator *   g_udev_enumerator_add_nomatch_sysfs_attr
                                                         (GUdevEnumerator *enumerator,
@@ -268,22 +253,19 @@ All returned devices will not have a sysfs attribute matching the given 
 
 

enumerator :

-A GUdevEnumerator. - +A GUdevEnumerator.

name :

-Wildcard filter for sysfs attribute key. - +Wildcard filter for sysfs attribute key.

value :

-Wildcard filter for sysfs attribute value. - +Wildcard filter for sysfs attribute value.

Returns :

- The passed in enumerator. [transfer none] +The passed in enumerator. [transfer none] @@ -291,7 +273,7 @@ All returned devices will not have a sysfs attribute matching the given Since 165


-
+

g_udev_enumerator_add_match_property ()

GUdevEnumerator *   g_udev_enumerator_add_match_property
                                                         (GUdevEnumerator *enumerator,
@@ -305,22 +287,19 @@ All returned devices will have a property matching the given enumerator :

-A GUdevEnumerator. - +A GUdevEnumerator.

name :

-Wildcard filter for property name. - +Wildcard filter for property name.

value :

-Wildcard filter for property value. - +Wildcard filter for property value.

Returns :

- The passed in enumerator. [transfer none] +The passed in enumerator. [transfer none] @@ -328,7 +307,7 @@ All returned devices will have a property matching the given Since 165


-
+

g_udev_enumerator_add_match_name ()

GUdevEnumerator *   g_udev_enumerator_add_match_name    (GUdevEnumerator *enumerator,
                                                          const gchar *name);
@@ -340,17 +319,15 @@ All returned devices will match the given name

enumerator :

-A GUdevEnumerator. - +A GUdevEnumerator.

name :

-Wildcard filter for kernel name e.g. "sda*". - +Wildcard filter for kernel name e.g. "sda*".

Returns :

- The passed in enumerator. [transfer none] +The passed in enumerator. [transfer none] @@ -358,7 +335,7 @@ All returned devices will match the given nameSince 165


-
+

g_udev_enumerator_add_match_tag ()

GUdevEnumerator *   g_udev_enumerator_add_match_tag     (GUdevEnumerator *enumerator,
                                                          const gchar *tag);
@@ -370,17 +347,15 @@ All returned devices will match the given tag

enumerator :

-A GUdevEnumerator. - +A GUdevEnumerator.

tag :

-A udev tag e.g. "udev-acl". - +A udev tag e.g. "udev-acl".

Returns :

- The passed in enumerator. [transfer none] +The passed in enumerator. [transfer none] @@ -388,7 +363,7 @@ All returned devices will match the given tag

Since 165


-
+

g_udev_enumerator_add_match_is_initialized ()

GUdevEnumerator *   g_udev_enumerator_add_match_is_initialized
                                                         (GUdevEnumerator *enumerator);
@@ -400,12 +375,11 @@ All returned devices will be initialized.

enumerator :

-A GUdevEnumerator. - +A GUdevEnumerator.

Returns :

- The passed in enumerator. [transfer none] +The passed in enumerator. [transfer none] @@ -413,7 +387,7 @@ All returned devices will be initialized.

Since 165


-
+

g_udev_enumerator_add_sysfs_path ()

GUdevEnumerator *   g_udev_enumerator_add_sysfs_path    (GUdevEnumerator *enumerator,
                                                          const gchar *sysfs_path);
@@ -425,17 +399,15 @@ Add a device to the list of devices, to retrieve it back sorted in dependency or

enumerator :

-A GUdevEnumerator. - +A GUdevEnumerator.

sysfs_path :

-A sysfs path, e.g. "/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda" - +A sysfs path, e.g. "/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda"

Returns :

- The passed in enumerator. [transfer none] +The passed in enumerator. [transfer none] @@ -443,7 +415,7 @@ Add a device to the list of devices, to retrieve it back sorted in dependency or

Since 165


-
+

g_udev_enumerator_execute ()

GList *             g_udev_enumerator_execute           (GUdevEnumerator *enumerator);

@@ -454,12 +426,11 @@ Executes the query in enumerator.

enumerator :

-A GUdevEnumerator. - +A GUdevEnumerator.

Returns :

- A list of GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. [element-type GUdevDevice][transfer full GUdevDevice] +A list of GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. [element-type GUdevDevice][transfer full] @@ -467,9 +438,9 @@ Executes the query in enumerator.

Since 165

-
+

Property Details

-
+

The "client" property

  "client"                   GUdevClient*          : Read / Write / Construct Only

@@ -481,6 +452,6 @@ The


- Generated by GTK-Doc V1.15
+ Generated by GTK-Doc V1.18
\ No newline at end of file diff --git a/extras/gudev/docs/html/gudev-hierarchy.html b/extras/gudev/docs/html/gudev-hierarchy.html index fc736ff..71de82c 100644 --- a/extras/gudev/docs/html/gudev-hierarchy.html +++ b/extras/gudev/docs/html/gudev-hierarchy.html @@ -3,12 +3,12 @@ Object Hierarchy - + - + @@ -19,7 +19,7 @@ GUDev Reference Manual Next -
+

Object Hierarchy

@@ -27,10 +27,12 @@
         GUdevDevice
         GUdevClient
         GUdevEnumerator
+    GEnum
+        GUdevDeviceType
 
+ Generated by GTK-Doc V1.18
\ No newline at end of file diff --git a/extras/gudev/docs/html/gudev.devhelp b/extras/gudev/docs/html/gudev.devhelp deleted file mode 100644 index 031fe58..0000000 --- a/extras/gudev/docs/html/gudev.devhelp +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extras/gudev/docs/html/gudev.devhelp2 b/extras/gudev/docs/html/gudev.devhelp2 index 1383848..d682679 100644 --- a/extras/gudev/docs/html/gudev.devhelp2 +++ b/extras/gudev/docs/html/gudev.devhelp2 @@ -13,8 +13,8 @@ - - + + @@ -25,7 +25,7 @@ - + @@ -58,7 +58,7 @@ - + diff --git a/extras/gudev/docs/html/index.html b/extras/gudev/docs/html/index.html index 4a92419..ecedc5b 100644 --- a/extras/gudev/docs/html/index.html +++ b/extras/gudev/docs/html/index.html @@ -3,14 +3,14 @@ GUDev Reference Manual - + - + -
+
@@ -32,11 +32,11 @@   

-

For GUdev version 166 +

For GUdev version 174

-
-
-

+

+
+

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later @@ -88,6 +88,6 @@

+ Generated by GTK-Doc V1.18
\ No newline at end of file diff --git a/extras/gudev/docs/html/index.sgml b/extras/gudev/docs/html/index.sgml index eda918c..da4eb0f 100644 --- a/extras/gudev/docs/html/index.sgml +++ b/extras/gudev/docs/html/index.sgml @@ -1,5 +1,6 @@ + @@ -7,7 +8,7 @@ - + diff --git a/extras/gudev/docs/html/ix01.html b/extras/gudev/docs/html/ix01.html index 263a083..7f253f4 100644 --- a/extras/gudev/docs/html/ix01.html +++ b/extras/gudev/docs/html/ix01.html @@ -3,12 +3,12 @@ Index - + - + @@ -19,9 +19,9 @@ GUDev Reference Manual Next -
+

-Index

+Index

C

@@ -143,21 +143,21 @@
GUdevClient:subsystems, The "subsystems" property
-
GUdevClientClass, GUdevClientClass +
GUdevClientClass, struct GUdevClientClass
GUdevDevice, GUdevDevice
-
GUdevDeviceClass, GUdevDeviceClass +
GUdevDeviceClass, struct GUdevDeviceClass
GUdevDeviceNumber, GUdevDeviceNumber
-
GUdevDeviceType, enum GUdevDeviceType +
GUdevDeviceType, enum GUdevDeviceType
GUdevEnumerator, GUdevEnumerator
GUdevEnumerator:client, The "client" property
-
GUdevEnumeratorClass, GUdevEnumeratorClass +
GUdevEnumeratorClass, struct GUdevEnumeratorClass
@@ -165,6 +165,6 @@
+ Generated by GTK-Doc V1.18
\ No newline at end of file diff --git a/extras/gudev/docs/html/ix02.html b/extras/gudev/docs/html/ix02.html index aa31a51..d1e9be3 100644 --- a/extras/gudev/docs/html/ix02.html +++ b/extras/gudev/docs/html/ix02.html @@ -3,11 +3,11 @@ Index of new symbols in 165 - + - + @@ -27,9 +27,9 @@ G -
+

-Index of new symbols in 165

+Index of new symbols in 165

D

g_udev_device_get_is_initialized, function in GUdevDevice @@ -98,12 +98,12 @@
-GUdevEnumeratorClass, struct in GUdevEnumerator +GUdevEnumeratorClass, struct in GUdevEnumerator
+ Generated by GTK-Doc V1.18
\ No newline at end of file diff --git a/extras/gudev/docs/html/ref-API.html b/extras/gudev/docs/html/ref-API.html index a6e3064..a9d356e 100644 --- a/extras/gudev/docs/html/ref-API.html +++ b/extras/gudev/docs/html/ref-API.html @@ -3,12 +3,12 @@ API Reference - + - + @@ -19,13 +19,13 @@ GUDev Reference Manual Next -
+

API Reference


-
+

This part presents the class and function reference for the @@ -49,6 +49,6 @@

+ Generated by GTK-Doc V1.18
\ No newline at end of file diff --git a/extras/gudev/docs/html/style.css b/extras/gudev/docs/html/style.css index d544a2c..d6f6c26 100644 --- a/extras/gudev/docs/html/style.css +++ b/extras/gudev/docs/html/style.css @@ -32,8 +32,9 @@ /* this is needed so that the local anchors are displayed below the naviagtion */ div.footnote a[name], div.refnamediv a[name], div.refsect1 a[name], div.refsect2 a[name], div.index a[name], div.glossary a[name], div.sect1 a[name] { + display: inline-block; position: relative; - padding-top:4.5em; + top:-5em; } /* this seems to be a bug in the xsl style sheets when generating indexes */ div.index div.index diff --git a/extras/gudev/docs/tmpl/gudevenumtypes.sgml b/extras/gudev/docs/tmpl/gudevenumtypes.sgml new file mode 100644 index 0000000..79e26e3 --- /dev/null +++ b/extras/gudev/docs/tmpl/gudevenumtypes.sgml @@ -0,0 +1,24 @@ + +gudevenumtypes + + + + + + + + + + + + + + + + + + + + + + diff --git a/extras/gudev/docs/tmpl/gudevmarshal.sgml b/extras/gudev/docs/tmpl/gudevmarshal.sgml new file mode 100644 index 0000000..ec46d46 --- /dev/null +++ b/extras/gudev/docs/tmpl/gudevmarshal.sgml @@ -0,0 +1,24 @@ + +gudevmarshal + + + + + + + + + + + + + + + + + + + + + + diff --git a/extras/gudev/docs/version.xml b/extras/gudev/docs/version.xml index cdffbbc..c5356ba 100644 --- a/extras/gudev/docs/version.xml +++ b/extras/gudev/docs/version.xml @@ -1 +1 @@ -166 +174 diff --git a/extras/gudev/gjs-example.js b/extras/gudev/gjs-example.js new file mode 100755 index 0000000..5586fd6 --- /dev/null +++ b/extras/gudev/gjs-example.js @@ -0,0 +1,75 @@ +#!/usr/bin/env gjs-console + +// This currently depends on the following patches to gjs +// +// http://bugzilla.gnome.org/show_bug.cgi?id=584558 +// http://bugzilla.gnome.org/show_bug.cgi?id=584560 +// http://bugzilla.gnome.org/show_bug.cgi?id=584568 + +const GUdev = imports.gi.GUdev; +const Mainloop = imports.mainloop; + +function print_device (device) { + print (" subsystem: " + device.get_subsystem ()); + print (" devtype: " + device.get_devtype ()); + print (" name: " + device.get_name ()); + print (" number: " + device.get_number ()); + print (" sysfs_path: " + device.get_sysfs_path ()); + print (" driver: " + device.get_driver ()); + print (" action: " + device.get_action ()); + print (" seqnum: " + device.get_seqnum ()); + print (" device type: " + device.get_device_type ()); + print (" device number: " + device.get_device_number ()); + print (" device file: " + device.get_device_file ()); + print (" device file symlinks: " + device.get_device_file_symlinks ()); + print (" foo: " + device.get_sysfs_attr_as_strv ("stat")); + var keys = device.get_property_keys (); + for (var n = 0; n < keys.length; n++) { + print (" " + keys[n] + "=" + device.get_property (keys[n])); + } +} + +function on_uevent (client, action, device) { + print ("action " + action + " on device " + device.get_sysfs_path()); + print_device (device); + print (""); +} + +var client = new GUdev.Client ({subsystems: ["block", "usb/usb_interface"]}); +client.connect ("uevent", on_uevent); + +var block_devices = client.query_by_subsystem ("block"); +for (var n = 0; n < block_devices.length; n++) { + print ("block device: " + block_devices[n].get_device_file ()); +} + +var d; + +d = client.query_by_device_number (GUdev.DeviceType.BLOCK, 0x0810); +if (d == null) { + print ("query_by_device_number 0x810 -> null"); +} else { + print ("query_by_device_number 0x810 -> " + d.get_device_file ()); + var dd = d.get_parent_with_subsystem ("usb", null); + print_device (dd); + print ("--------------------------------------------------------------------------"); + while (d != null) { + print_device (d); + print (""); + d = d.get_parent (); + } +} + +d = client.query_by_sysfs_path ("/sys/block/sda/sda1"); +print ("query_by_sysfs_path (\"/sys/block/sda1\") -> " + d.get_device_file ()); + +d = client.query_by_subsystem_and_name ("block", "sda2"); +print ("query_by_subsystem_and_name (\"block\", \"sda2\") -> " + d.get_device_file ()); + +d = client.query_by_device_file ("/dev/sda"); +print ("query_by_device_file (\"/dev/sda\") -> " + d.get_device_file ()); + +d = client.query_by_device_file ("/dev/block/8:0"); +print ("query_by_device_file (\"/dev/block/8:0\") -> " + d.get_device_file ()); + +Mainloop.run('udev-example'); diff --git a/extras/gudev/gudevclient.c b/extras/gudev/gudevclient.c index 853454b..97b951a 100644 --- a/extras/gudev/gudevclient.c +++ b/extras/gudev/gudevclient.c @@ -460,6 +460,8 @@ g_udev_client_query_by_device_file (GUdevClient *client, * @sysfs_path: A sysfs path. * * Looks up a device for a sysfs path. + * + * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). */ GUdevDevice * g_udev_client_query_by_sysfs_path (GUdevClient *client, diff --git a/extras/gudev/gudevclient.h b/extras/gudev/gudevclient.h index 6e365c6..b425d03 100644 --- a/extras/gudev/gudevclient.h +++ b/extras/gudev/gudevclient.h @@ -41,7 +41,6 @@ typedef struct _GUdevClientPrivate GUdevClientPrivate; /** * GUdevClient: - * @parent: Parent instance. * * The #GUdevClient struct is opaque and should not be accessed directly. */ diff --git a/extras/gudev/gudevdevice.h b/extras/gudev/gudevdevice.h index ab22371..d4873ba 100644 --- a/extras/gudev/gudevdevice.h +++ b/extras/gudev/gudevdevice.h @@ -41,7 +41,6 @@ typedef struct _GUdevDevicePrivate GUdevDevicePrivate; /** * GUdevDevice: - * @parent: Parent instance. * * The #GUdevDevice struct is opaque and should not be accessed directly. */ diff --git a/extras/gudev/gudevenumerator.h b/extras/gudev/gudevenumerator.h index ed54dbf..3fddccf 100644 --- a/extras/gudev/gudevenumerator.h +++ b/extras/gudev/gudevenumerator.h @@ -41,7 +41,6 @@ typedef struct _GUdevEnumeratorPrivate GUdevEnumeratorPrivate; /** * GUdevEnumerator: - * @parent: Parent instance. * * The #GUdevEnumerator struct is opaque and should not be accessed directly. * diff --git a/extras/gudev/seed-example-enum.js b/extras/gudev/seed-example-enum.js new file mode 100755 index 0000000..66206ad --- /dev/null +++ b/extras/gudev/seed-example-enum.js @@ -0,0 +1,38 @@ +#!/usr/bin/env seed + +const GLib = imports.gi.GLib; +const GUdev = imports.gi.GUdev; + +function print_device(device) { + print(" initialized: " + device.get_is_initialized()); + print(" usec since initialized: " + device.get_usec_since_initialized()); + print(" subsystem: " + device.get_subsystem()); + print(" devtype: " + device.get_devtype()); + print(" name: " + device.get_name()); + print(" number: " + device.get_number()); + print(" sysfs_path: " + device.get_sysfs_path()); + print(" driver: " + device.get_driver()); + print(" action: " + device.get_action()); + print(" seqnum: " + device.get_seqnum()); + print(" device type: " + device.get_device_type()); + print(" device number: " + device.get_device_number()); + print(" device file: " + device.get_device_file()); + print(" device file symlinks: " + device.get_device_file_symlinks()); + print(" tags: " + device.get_tags()); + var keys = device.get_property_keys(); + for (var n = 0; n < keys.length; n++) { + print(" " + keys[n] + "=" + device.get_property(keys[n])); + } +} + +var client = new GUdev.Client({subsystems: []}); +var enumerator = new GUdev.Enumerator({client: client}); +enumerator.add_match_subsystem('b*') + +var devices = enumerator.execute(); + +for (var n=0; n < devices.length; n++) { + var device = devices[n]; + print_device(device); + print(""); +} diff --git a/extras/gudev/seed-example.js b/extras/gudev/seed-example.js new file mode 100755 index 0000000..e2ac324 --- /dev/null +++ b/extras/gudev/seed-example.js @@ -0,0 +1,72 @@ +#!/usr/bin/env seed + +// seed example + +const GLib = imports.gi.GLib; +const GUdev = imports.gi.GUdev; + +function print_device (device) { + print (" subsystem: " + device.get_subsystem ()); + print (" devtype: " + device.get_devtype ()); + print (" name: " + device.get_name ()); + print (" number: " + device.get_number ()); + print (" sysfs_path: " + device.get_sysfs_path ()); + print (" driver: " + device.get_driver ()); + print (" action: " + device.get_action ()); + print (" seqnum: " + device.get_seqnum ()); + print (" device type: " + device.get_device_type ()); + print (" device number: " + device.get_device_number ()); + print (" device file: " + device.get_device_file ()); + print (" device file symlinks: " + device.get_device_file_symlinks ()); + print (" foo: " + device.get_sysfs_attr_as_strv ("stat")); + var keys = device.get_property_keys (); + for (var n = 0; n < keys.length; n++) { + print (" " + keys[n] + "=" + device.get_property (keys[n])); + } +} + +function on_uevent (client, action, device) { + print ("action " + action + " on device " + device.get_sysfs_path()); + print_device (device); + print (""); +} + +var client = new GUdev.Client ({subsystems: ["block", "usb/usb_interface"]}); +client.signal.connect ("uevent", on_uevent); + +var block_devices = client.query_by_subsystem ("block"); +for (var n = 0; n < block_devices.length; n++) { + print ("block device: " + block_devices[n].get_device_file ()); +} + +var d; + +d = client.query_by_device_number (GUdev.DeviceType.BLOCK, 0x0810); +if (d == null) { + print ("query_by_device_number 0x810 -> null"); +} else { + print ("query_by_device_number 0x810 -> " + d.get_device_file ()); + dd = d.get_parent_with_subsystem ("usb", null); + print_device (dd); + print ("--------------------------------------------------------------------------"); + while (d != null) { + print_device (d); + print (""); + d = d.get_parent (); + } +} + +d = client.query_by_sysfs_path ("/sys/block/sda/sda1"); +print ("query_by_sysfs_path (\"/sys/block/sda1\") -> " + d.get_device_file ()); + +d = client.query_by_subsystem_and_name ("block", "sda2"); +print ("query_by_subsystem_and_name (\"block\", \"sda2\") -> " + d.get_device_file ()); + +d = client.query_by_device_file ("/dev/sda"); +print ("query_by_device_file (\"/dev/sda\") -> " + d.get_device_file ()); + +d = client.query_by_device_file ("/dev/block/8:0"); +print ("query_by_device_file (\"/dev/block/8:0\") -> " + d.get_device_file ()); + +var mainloop = GLib.main_loop_new (); +GLib.main_loop_run (mainloop); diff --git a/extras/hid2hci/70-hid2hci.rules b/extras/hid2hci/70-hid2hci.rules deleted file mode 100644 index 3b36629..0000000 --- a/extras/hid2hci/70-hid2hci.rules +++ /dev/null @@ -1,30 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="hid2hci_end" -SUBSYSTEM!="usb", GOTO="hid2hci_end" - -# Variety of Dell Bluetooth devices - match on a mouse device that is -# self powered and where a HID report needs to be sent to switch modes -# Known supported devices: 413c:8154, 413c:8158, 413c:8162 -ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProtocol}=="02", \ - ATTRS{bDeviceClass}=="00", ATTRS{idVendor}=="413c", ATTRS{bmAttributes}=="e0", \ - RUN+="hid2hci --method=dell --devpath=%p", ENV{HID2HCI_SWITCH}="1" - -# Logitech devices -KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[35e]", \ - RUN+="hid2hci --method=logitech-hid --devpath=%p" -KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[4abc]|c71[34bc]", \ - RUN+="hid2hci --method=logitech-hid --devpath=%p" - -ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" - -# When a Dell device recovers from S3, the mouse child needs to be repoked -# Unfortunately the only event seen is the BT device disappearing, so the mouse -# device needs to be chased down on the USB bus. -ATTR{bDeviceClass}=="e0", ATTR{bDeviceSubClass}=="01", ATTR{bDeviceProtocol}=="01", ATTR{idVendor}=="413c", \ - ENV{REMOVE_CMD}="/sbin/udevadm trigger --action=change --subsystem-match=usb --property-match=HID2HCI_SWITCH=1" - -# CSR devices -ATTR{idVendor}=="0a12|0458|05ac", ATTR{idProduct}=="1000", RUN+="hid2hci --method=csr --devpath=%p" - -LABEL="hid2hci_end" diff --git a/extras/hid2hci/hid2hci.c b/extras/hid2hci/hid2hci.c deleted file mode 100644 index 839c4fb..0000000 --- a/extras/hid2hci/hid2hci.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * hid2hci : switch the radio on devices that support - * it from HID to HCI and back - * - * Copyright (C) 2003-2009 Marcel Holtmann - * Copyright (C) 2008-2009 Mario Limonciello - * Copyright (C) 2009 Kay Sievers - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -enum mode { - HCI = 0, - HID = 1, -}; - -static int usb_switch_csr(struct usb_dev_handle *dev, enum mode mode) -{ - int err; - - err = usb_control_msg(dev, - USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0, mode, 0, NULL, 0, 10000); - if (err == 0) { - err = -1; - errno = EALREADY; - } else { - if (errno == ETIMEDOUT) - err = 0; - } - return err; -} - -static int hid_logitech_send_report(int fd, const char *buf, size_t size) -{ - struct hiddev_report_info rinfo; - struct hiddev_usage_ref uref; - unsigned int i; - int err; - - for (i = 0; i < size; i++) { - memset(&uref, 0, sizeof(uref)); - uref.report_type = HID_REPORT_TYPE_OUTPUT; - uref.report_id = 0x10; - uref.field_index = 0; - uref.usage_index = i; - uref.usage_code = 0xff000001; - uref.value = buf[i] & 0x000000ff; - err = ioctl(fd, HIDIOCSUSAGE, &uref); - if (err < 0) - return err; - } - - memset(&rinfo, 0, sizeof(rinfo)); - rinfo.report_type = HID_REPORT_TYPE_OUTPUT; - rinfo.report_id = 0x10; - rinfo.num_fields = 1; - err = ioctl(fd, HIDIOCSREPORT, &rinfo); - - return err; -} - -static int hid_switch_logitech(const char *filename) -{ - char rep1[] = { 0xff, 0x80, 0x80, 0x01, 0x00, 0x00 }; - char rep2[] = { 0xff, 0x80, 0x00, 0x00, 0x30, 0x00 }; - char rep3[] = { 0xff, 0x81, 0x80, 0x00, 0x00, 0x00 }; - int fd; - int err = -1; - - fd = open(filename, O_RDWR); - if (fd < 0) - return err; - - err = ioctl(fd, HIDIOCINITREPORT, 0); - if (err < 0) - goto out; - - err = hid_logitech_send_report(fd, rep1, sizeof(rep1)); - if (err < 0) - goto out; - - err = hid_logitech_send_report(fd, rep2, sizeof(rep2)); - if (err < 0) - goto out; - - err = hid_logitech_send_report(fd, rep3, sizeof(rep3)); -out: - close(fd); - return err; -} - -static int usb_switch_dell(struct usb_dev_handle *dev, enum mode mode) -{ - char report[] = { 0x7f, 0x00, 0x00, 0x00 }; - int err; - - switch (mode) { - case HCI: - report[1] = 0x13; - break; - case HID: - report[1] = 0x14; - break; - } - - /* Don't need to check return, as might not be in use */ - usb_detach_kernel_driver_np(dev, 0); - - if (usb_claim_interface(dev, 0) < 0) - return -EIO; - - err = usb_control_msg(dev, - USB_ENDPOINT_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, - USB_REQ_SET_CONFIGURATION, 0x7f | (0x03 << 8), 0, - report, sizeof(report), 5000); - - if (err == 0) { - err = -1; - errno = EALREADY; - } else { - if (errno == ETIMEDOUT) - err = 0; - } - return err; -} - -/* - * The braindead libusb needs to scan and open all devices, just to - * to find the device we already have. This needs to be fixed in libusb - * or it will be ripped out and we carry our own code. - */ -static struct usb_device *usb_device_open_from_udev(struct udev_device *usb_dev) -{ - struct usb_bus *bus; - const char *str; - int busnum; - int devnum; - - str = udev_device_get_sysattr_value(usb_dev, "busnum"); - if (str == NULL) - return NULL; - busnum = strtol(str, NULL, 0); - - str = udev_device_get_sysattr_value(usb_dev, "devnum"); - if (str == NULL) - return NULL; - devnum = strtol(str, NULL, 0); - - usb_init(); - usb_find_busses(); - usb_find_devices(); - - for (bus = usb_get_busses(); bus; bus = bus->next) { - struct usb_device *dev; - - if (strtol(bus->dirname, NULL, 10) != busnum) - continue; - - for (dev = bus->devices; dev; dev = dev->next) { - if (dev->devnum == devnum) - return dev; - } - } - - return NULL; -} - -static struct usb_dev_handle *find_device(struct udev_device *udev_dev) -{ - struct usb_device *dev; - - dev = usb_device_open_from_udev(udev_dev); - if (dev == NULL) - return NULL; - return usb_open(dev); -} - -static void usage(const char *error) -{ - if (error) - fprintf(stderr,"\n%s\n", error); - else - printf("hid2hci - Bluetooth HID to HCI mode switching utility\n\n"); - - printf("Usage: hid2hci [options]\n" - " --mode= mode to switch to [hid|hci] (default hci)\n" - " --devpath= sys device path\n" - " --method= method to use to switch [csr|logitech-hid|dell]\n" - " --help\n\n"); -} - -int main(int argc, char *argv[]) -{ - static const struct option options[] = { - { "help", no_argument, NULL, 'h' }, - { "mode", required_argument, NULL, 'm' }, - { "devpath", required_argument, NULL, 'p' }, - { "method", required_argument, NULL, 'M' }, - { } - }; - enum method { - METHOD_UNDEF, - METHOD_CSR, - METHOD_LOGITECH_HID, - METHOD_DELL, - } method = METHOD_UNDEF; - struct udev *udev; - struct udev_device *udev_dev = NULL; - char syspath[UTIL_PATH_SIZE]; - int (*usb_switch)(struct usb_dev_handle *dev, enum mode mode) = NULL; - enum mode mode = HCI; - const char *devpath = NULL; - int err = -1; - int rc = 1; - - for (;;) { - int option; - - option = getopt_long(argc, argv, "m:p:M:qh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'm': - if (!strcmp(optarg, "hid")) { - mode = HID; - } else if (!strcmp(optarg, "hci")) { - mode = HCI; - } else { - usage("error: undefined radio mode\n"); - exit(1); - } - break; - case 'p': - devpath = optarg; - break; - case 'M': - if (!strcmp(optarg, "csr")) { - method = METHOD_CSR; - usb_switch = usb_switch_csr; - } else if (!strcmp(optarg, "logitech-hid")) { - method = METHOD_LOGITECH_HID; - } else if (!strcmp(optarg, "dell")) { - method = METHOD_DELL; - usb_switch = usb_switch_dell; - } else { - usage("error: undefined switching method\n"); - exit(1); - } - break; - case 'h': - usage(NULL); - default: - exit(1); - } - } - - if (!devpath || method == METHOD_UNDEF) { - usage("error: --devpath= and --method= must be defined\n"); - exit(1); - } - - udev = udev_new(); - if (udev == NULL) - goto exit; - - util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); - udev_dev = udev_device_new_from_syspath(udev, syspath); - if (udev_dev == NULL) { - fprintf(stderr, "error: could not find '%s'\n", devpath); - goto exit; - } - - switch (method) { - case METHOD_CSR: - case METHOD_DELL: { - struct udev_device *dev; - struct usb_dev_handle *handle; - const char *type; - - /* get the parent usb_device if needed */ - dev = udev_dev; - type = udev_device_get_devtype(dev); - if (type == NULL || strcmp(type, "usb_device") != 0) { - dev = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_device"); - if (dev == NULL) { - fprintf(stderr, "error: could not find usb_device for '%s'\n", devpath); - goto exit; - } - } - - handle = find_device(dev); - if (handle == NULL) { - fprintf(stderr, "error: unable to handle '%s'\n", - udev_device_get_syspath(dev)); - goto exit; - } - err = usb_switch(handle, mode); - break; - } - case METHOD_LOGITECH_HID: { - const char *device; - - device = udev_device_get_devnode(udev_dev); - if (device == NULL) { - fprintf(stderr, "error: could not find hiddev device node\n"); - goto exit; - } - err = hid_switch_logitech(device); - break; - } - default: - break; - } - - if (err < 0) - fprintf(stderr, "error: switching device '%s' failed.\n", - udev_device_get_syspath(udev_dev)); -exit: - udev_device_unref(udev_dev); - udev_unref(udev); - return rc; -} diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c deleted file mode 100644 index 602c90d..0000000 --- a/extras/input_id/input_id.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * input_id - input device classification - * - * Copyright (C) 2009 Martin Pitt - * Portions Copyright (C) 2004 David Zeuthen, - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with keymap; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include -#include -#include -#include -#include -#include - -#include "libudev.h" - -/* we must use this kernel-compatible implementation */ -#define BITS_PER_LONG (sizeof(unsigned long) * 8) -#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) -#define OFF(x) ((x)%BITS_PER_LONG) -#define BIT(x) (1UL<> OFF(bit)) & 1) - -/* - * Read a capability attribute and return bitmask. - * @param dev udev_device - * @param attr sysfs attribute name (e. g. "capabilities/key") - * @param bitmask: Output array; must have max_size elements - */ -static void get_cap_mask (struct udev_device *dev, const char* attr, - unsigned long *bitmask, size_t max_size) -{ - char text[4096]; - int i; - char* word; - unsigned long val; - - snprintf(text, sizeof(text), "%s", udev_device_get_sysattr_value(dev, attr)); - - memset (bitmask, 0, max_size); - i = 0; - while ((word = strrchr(text, ' ')) != NULL) { - val = strtoul (word+1, NULL, 16); - bitmask[i] = val; - *word = '\0'; - ++i; - } - val = strtoul (text, NULL, 16); - bitmask[i] = val; -} - -/* pointer devices */ -static void test_pointers (const unsigned long* bitmask_ev, - const unsigned long* bitmask_abs, - const unsigned long* bitmask_key, - const unsigned long* bitmask_rel) -{ - int is_mouse = 0; - int is_touchpad = 0; - - if (!test_bit (EV_KEY, bitmask_ev)) - return; - - if (test_bit (EV_ABS, bitmask_ev) && - test_bit (ABS_X, bitmask_abs) && test_bit (ABS_Y, bitmask_abs)) { - if (test_bit (BTN_STYLUS, bitmask_key) || test_bit (BTN_TOOL_PEN, bitmask_key)) - puts("ID_INPUT_TABLET=1"); - else if (test_bit (BTN_TOOL_FINGER, bitmask_key) && !test_bit (BTN_TOOL_PEN, bitmask_key)) - is_touchpad = 1; - else if (test_bit (BTN_TRIGGER, bitmask_key) || - test_bit (BTN_A, bitmask_key) || - test_bit (BTN_1, bitmask_key)) - puts("ID_INPUT_JOYSTICK=1"); - else if (test_bit (BTN_MOUSE, bitmask_key)) - /* This path is taken by VMware's USB mouse, which has - * absolute axes, but no touch/pressure button. */ - is_mouse = 1; - else if (test_bit (BTN_TOUCH, bitmask_key)) - puts("ID_INPUT_TOUCHSCREEN=1"); - } - - if (test_bit (EV_REL, bitmask_ev) && - test_bit (REL_X, bitmask_rel) && test_bit (REL_Y, bitmask_rel) && - test_bit (BTN_MOUSE, bitmask_key)) - is_mouse = 1; - - if (is_mouse) - puts("ID_INPUT_MOUSE=1"); - if (is_touchpad) - puts("ID_INPUT_TOUCHPAD=1"); -} - -/* key like devices */ -static void test_key (const unsigned long* bitmask_ev, - const unsigned long* bitmask_key) -{ - unsigned i; - unsigned long acc; - unsigned long mask; - - /* do we have any KEY_* capability? */ - if (!test_bit (EV_KEY, bitmask_ev)) - return; - - acc = 0; - for (i = 0; i < BTN_MISC/BITS_PER_LONG; ++i) - acc |= bitmask_key[i]; - if (acc > 0) - puts("ID_INPUT_KEY=1"); - - /* the first 32 bits are ESC, numbers, and Q to D; if we have all of - * those, consider it a full keyboard; do not test KEY_RESERVED, though */ - mask = 0xFFFFFFFE; - if ((bitmask_key[0] & mask) == mask) - puts("ID_INPUT_KEYBOARD=1"); -} - -int main (int argc, char** argv) -{ - struct udev *udev; - struct udev_device *dev; - - char devpath[PATH_MAX]; - unsigned long bitmask_ev[NBITS(EV_MAX)]; - unsigned long bitmask_abs[NBITS(ABS_MAX)]; - unsigned long bitmask_key[NBITS(KEY_MAX)]; - unsigned long bitmask_rel[NBITS(REL_MAX)]; - - if (argc != 2) { - fprintf(stderr, "Usage: %s \n", argv[0]); - exit(1); - } - - /* get the device */ - udev = udev_new(); - if (udev == NULL) - return 1; - - snprintf(devpath, sizeof(devpath), "%s/%s", udev_get_sys_path(udev), argv[1]); - dev = udev_device_new_from_syspath(udev, devpath); - if (dev == NULL) { - fprintf(stderr, "unable to access '%s'\n", devpath); - return 1; - } - - /* walk up the parental chain until we find the real input device; the - * argument is very likely a subdevice of this, like eventN */ - while (dev != NULL && udev_device_get_sysattr_value(dev, "capabilities/ev") == NULL) - dev = udev_device_get_parent_with_subsystem_devtype(dev, "input", NULL); - - /* not an "input" class device */ - if (dev == NULL) - return 0; - - /* Use this as a flag that input devices were detected, so that this - * program doesn't need to be called more than once per device */ - puts("ID_INPUT=1"); - - get_cap_mask (dev, "capabilities/ev", bitmask_ev, sizeof (bitmask_ev)); - get_cap_mask (dev, "capabilities/abs", bitmask_abs, sizeof (bitmask_abs)); - get_cap_mask (dev, "capabilities/rel", bitmask_rel, sizeof (bitmask_rel)); - get_cap_mask (dev, "capabilities/key", bitmask_key, sizeof (bitmask_key)); - - test_pointers(bitmask_ev, bitmask_abs, bitmask_key, bitmask_rel); - - test_key(bitmask_ev, bitmask_key); - - return 0; -} diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 8d5f83a..448db56 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -31,7 +31,7 @@ ENV{DMI_VENDOR}=="MTC", ATTR{[dmi/id]product_version}=="A0", RUN+="keyboard-forc ENV{DMI_VENDOR}=="PEGATRON CORP.", ATTR{[dmi/id]product_name}=="Spring Peak", RUN+="keyboard-force-release.sh $devpath common-volume-keys" -ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite U300|Satellite Pro U300|Satellite U305|SATELLITE U500", RUN+="keyboard-force-release.sh $devpath common-volume-keys" +ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite [uU]300*|Satellite Pro [uU]300*|Satellite [uU]305*|SATELLITE [uU]500*", RUN+="keyboard-force-release.sh $devpath common-volume-keys" ENV{DMI_VENDOR}=="Viooo Corporation", ATTR{[dmi/id]product_name}=="PT17", RUN+="keyboard-force-release.sh $devpath common-volume-keys" @@ -44,4 +44,6 @@ ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote 6615WD", RUN+="keyb ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote", ATTR{[dmi/id]product_version}=="6625WD", RUN+="keyboard-force-release.sh $devpath common-volume-keys" +ENV{DMI_VENDOR}=="HANNspree", ATTR{[dmi/id]product_name}=="SN10E100", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + LABEL="force_release_end" diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index dd511d5..0742787 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -6,10 +6,11 @@ # pairs. ACTION=="remove", GOTO="keyboard_end" -SUBSYSTEM!="input", GOTO="keyboard_end" KERNEL!="event*", GOTO="keyboard_end" +ENV{ID_INPUT_KEY}=="", GOTO="keyboard_end" +SUBSYSTEMS=="bluetooth", GOTO="keyboard_end" -SUBSYSTEMS=="usb", ENV{ID_VENDOR}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" SUBSYSTEMS=="usb", GOTO="keyboard_usbcheck" GOTO="keyboard_modulecheck" @@ -19,14 +20,17 @@ GOTO="keyboard_modulecheck" LABEL="keyboard_usbcheck" +ENV{ID_VENDOR}=="Genius", ENV{ID_MODEL_ID}=="0708", ENV{ID_USB_INTERFACE_NUM}=="01", RUN+="keymap $name genius-slimstar-320" ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Multimedia Keyboard", RUN+="keymap $name logitech-wave" ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-cordless" # Logitech Cordless Wave Pro looks slightly weird; some hotkeys are coming through the mouse interface -ENV{ID_VENDOR_ID}=="046d", ENV{ID_MODEL_ID}=="c529", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-pro-cordless" +ENV{ID_VENDOR_ID}=="046d", ENV{ID_MODEL_ID}=="c52[9b]", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-pro-cordless" ENV{ID_VENDOR}=="Lite-On_Technology_Corp*", ATTRS{name}=="Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint", RUN+="keymap $name lenovo-thinkpad-usb-keyboard-trackpoint" ENV{ID_VENDOR_ID}=="04b3", ENV{ID_MODEL_ID}=="301[89]", RUN+="keymap $name ibm-thinkpad-usb-keyboard-trackpoint" +ENV{ID_VENDOR}=="Microsoft", ENV{ID_MODEL_ID}=="00db", RUN+="keymap $name 0xc022d zoomin 0xc022e zoomout" + GOTO="keyboard_end" # @@ -46,6 +50,8 @@ ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Asus Extra Buttons", ENV{DMI_VENDOR}=="Sony*", KERNELS=="input*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony" ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC WMI hotkeys", RUN+="keymap $name 0x6B f21" ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC Hotkey Driver", RUN+="keymap $name 0x37 f21" +ENV{DMI_VENDOR}=="Acer*", KERNELS=="input*", ATTRS{name}=="Acer WMI hotkeys", RUN+="keymap $name 0x82 f21" +ENV{DMI_VENDOR}=="MICRO-STAR*|Micro-Star*", KERNELS=="input*", ATTRS{name}=="MSI Laptop hotkeys", RUN+="keymap $name 0x213 f22 0x214 f23" # Older Vaios have some different keys ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="*PCG-C1*|*PCG-K25*|*PCG-F1*|*PCG-F2*|*PCG-F3*|*PCG-F4*|*PCG-F5*|*PCG-F6*|*PCG-FX*|*PCG-FRV*|*PCG-GR*|*PCG-TR*|*PCG-NV*|*PCG-Z*|*VGN-S360*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-old" @@ -65,12 +71,13 @@ LABEL="keyboard_vendorcheck" ENV{DMI_VENDOR}=="Dell*", RUN+="keymap $name dell" ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 910|Inspiron 1010|Inspiron 1011|Inspiron 1012|Inspiron 1110|Inspiron 1210", RUN+="keymap $name 0x84 wlan" +ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Latitude XT2", RUN+="keymap $name dell-latitude-xt2" ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+="keymap $name compaq-e_evo" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*3000*", RUN+="keymap $name lenovo-3000" -ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X6*", ATTR{[dmi/id]product_version}=="* Tablet" RUN+="keymap $name lenovo-thinkpad_x6_tablet" -ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X20* Tablet*", ATTR{[dmi/id]product_version}=="* Tablet" RUN+="keymap $name lenovo-thinkpad_x200_tablet" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X6*", ATTR{[dmi/id]product_version}=="* Tablet", RUN+="keymap $name lenovo-thinkpad_x6_tablet" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X20* Tablet*", ATTR{[dmi/id]product_version}=="* Tablet", RUN+="keymap $name lenovo-thinkpad_x200_tablet" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*IdeaPad*", RUN+="keymap $name lenovo-ideapad" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_name}=="S10-*", RUN+="keymap $name lenovo-ideapad" ENV{DMI_VENDOR}=="LENOVO", ATTR{[dmi/id]product_version}=="*IdeaPad Y550*", RUN+="keymap $name 0x95 media 0xA3 play" @@ -98,6 +105,7 @@ ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keyma ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5720*", RUN+="keymap $name acer-aspire_5720" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 8930", RUN+="keymap $name acer-aspire_8930" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_serial}=="ZG8*", RUN+="keymap $name acer-aspire_5720" ENV{DMI_VENDOR}=="*BenQ*", ATTR{[dmi/id]product_name}=="*Joybook R22*", RUN+="keymap $name 0x6E wlan" @@ -115,8 +123,7 @@ ENV{DMI_VENDOR}=="LG*", ATTR{[dmi/id]product_name}=="*X110*", RUN+="keymap $name ENV{DMI_VENDOR}=="MEDION*", ATTR{[dmi/id]product_name}=="*FID2060*", RUN+="keymap $name medion-fid2060" ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $name medionnb-a555" -ENV{DMI_VENDOR}=="MICRO-STAR*", RUN+="keymap $name micro-star" -ENV{DMI_VENDOR}=="Micro-Star International", RUN+="keymap $name micro-star" +ENV{DMI_VENDOR}=="MICRO-STAR*|Micro-Star*", RUN+="keymap $name micro-star" # some MSI models generate ACPI/input events on the LNXVIDEO input devices, # plus some extra synthesized ones on atkbd as an echo of actually changing the diff --git a/extras/keymap/keymap.c b/extras/keymap/keymap.c index 719c30e..fadd7a3 100644 --- a/extras/keymap/keymap.c +++ b/extras/keymap/keymap.c @@ -141,8 +141,9 @@ static int dump_table(int fd) { int keycode; if ((keycode = evdev_get_keycode(fd, scancode, 1)) < 0) { - if (keycode != -2) - r = -1; + if (keycode == -2) + continue; + r = -1; break; } @@ -183,17 +184,9 @@ static void set_key(int fd, const char* scancode_str, const char* keyname) scancode, k->id); } -static int merge_table(int fd, const char *filename) { +static int merge_table(int fd, FILE *f) { int r = 0; int line = 0; - FILE* f; - - f = fopen(filename, "r"); - if (!f) { - perror(filename); - r = -1; - goto fail; - } while (!feof(f)) { char s[256], *p; @@ -242,20 +235,10 @@ static int merge_table(int fd, const char *filename) { scancode, new_keycode, old_keycode); } fail: + fclose(f); return r; } -static const char* default_keymap_path(const char* path) -{ - static char result[PATH_MAX]; - - /* If keymap file is given without a path, assume udev directory; must end with '/' * */ - if (!strchr(path, '/')) { - snprintf(result, sizeof(result), "%s%s", LIBEXECDIR "/keymaps/", path); - return result; - } - return path; -} /* read one event; return 1 if valid */ static int read_event(int fd, struct input_event* ev) @@ -423,7 +406,31 @@ int main(int argc, char **argv) /* two arguments (device, mapfile): set map file */ if (argc == optind+2) { - merge_table(fd, default_keymap_path(argv[optind+1])); + const char *filearg = argv[optind+1]; + if (strchr(filearg, '/')) { + /* Keymap file argument is a path */ + FILE *f = fopen(filearg, "r"); + if (f) + merge_table(fd, f); + else + perror(filearg); + } else { + /* Keymap file argument is a filename */ + /* Open override file if present, otherwise default file */ + char keymap_path[PATH_MAX]; + snprintf(keymap_path, sizeof(keymap_path), "%s%s", SYSCONFDIR "/udev/keymaps/", filearg); + FILE *f = fopen(keymap_path, "r"); + if (f) { + merge_table(fd, f); + } else { + snprintf(keymap_path, sizeof(keymap_path), "%s%s", LIBEXECDIR "/keymaps/", filearg); + f = fopen(keymap_path, "r"); + if (f) + merge_table(fd, f); + else + perror(keymap_path); + } + } return 0; } diff --git a/extras/keymap/keymaps/acer-aspire_5920g b/extras/keymap/keymaps/acer-aspire_5920g index 0e628bc..633c4e8 100644 --- a/extras/keymap/keymaps/acer-aspire_5920g +++ b/extras/keymap/keymaps/acer-aspire_5920g @@ -1,4 +1,5 @@ 0x8A media +0x92 media +0xA6 setup 0xB2 www -0x92 prog2 0xD9 bluetooth # (toggle) on-to-off diff --git a/extras/keymap/keymaps/dell-latitude-xt2 b/extras/keymap/keymaps/dell-latitude-xt2 new file mode 100644 index 0000000..39872f5 --- /dev/null +++ b/extras/keymap/keymaps/dell-latitude-xt2 @@ -0,0 +1,4 @@ +0x9B up # tablet rocker up +0x9E enter # tablet rocker press +0x9F back # tablet back +0xA3 down # tablet rocker down diff --git a/extras/keymap/keymaps/genius-slimstar-320 b/extras/keymap/keymaps/genius-slimstar-320 new file mode 100644 index 0000000..d0a3656 --- /dev/null +++ b/extras/keymap/keymaps/genius-slimstar-320 @@ -0,0 +1,35 @@ +# Genius SlimStar 320 +# +# Only buttons which are not properly mapped yet are configured below + +# "Scroll wheel", a circular up/down/left/right button. Aimed for scolling, +# but since there are no scrollleft/scrollright, let's map to back/forward. +0x900f0 scrollup +0x900f1 scrolldown +0x900f3 back +0x900f2 forward + +# Multimedia buttons, left side (from left to right) +# [W] +0x900f5 wordprocessor +# [Ex] +0x900f6 spreadsheet +# [P] +0x900f4 presentation +# Other five (calculator, playpause, stop, mute and eject) are OK + +# Right side, from left to right +# [e] +0xc0223 www +# "man" +0x900f7 chat +# "Y" +0x900fb prog1 +# [X] +0x900f8 close +# "picture" +0x900f9 graphicseditor +# "two windows" +0x900fd scale +# "lock" +0x900fc screenlock diff --git a/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint b/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint index bc91470..3e94547 100644 --- a/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint +++ b/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint @@ -10,4 +10,4 @@ 0x90011 prog1 # Thinkvantage button 0x90015 camera # Fn+F6 headset/camera VoIP key ?? -# 0x90010 # Microphone mute button ?? +0x90010 micmute # Microphone mute button diff --git a/extras/keymap/keymaps/module-lenovo b/extras/keymap/keymaps/module-lenovo index 9cb74b2..81b8fea 100644 --- a/extras/keymap/keymaps/module-lenovo +++ b/extras/keymap/keymaps/module-lenovo @@ -14,3 +14,4 @@ 0x15 volumedown 0x16 mute 0x17 prog1 # ThinkPad/ThinkVantage button (high keycode: "vendor") +0x1A prog2 # Microphone mute diff --git a/extras/keymap/keymaps/olpc-xo b/extras/keymap/keymaps/olpc-xo index 7fe0662..34434a1 100644 --- a/extras/keymap/keymaps/olpc-xo +++ b/extras/keymap/keymaps/olpc-xo @@ -2,18 +2,32 @@ 0x81 fn_esc 0xF9 camera 0xF8 sound # Fn-CAMERA = Mic -0xBB fn_f1 -0xBC fn_f2 -0xBD fn_f3 -0xBE fn_f4 -0xBF fn_f5 -0xC0 fn_f6 -0xC1 fn_f7 -0xC2 fn_f8 -0xC3 fn_f9 -0xC4 fn_f10 -0xD7 fn_f11 -0xD8 fn_f12 + + +# Function key mappings, as per +# http://dev.laptop.org/ticket/10213#comment:20 +# +# Unmodified F1-F8 produce F1-F8, so no remap necessary. +# Unmodified F9-F12 control brightness and volume. +0x43 brightnessdown +0x44 brightnessup +0x57 volumedown +0x58 volumeup + +# fn-modified fkeys all produce the unmodified version of the key. +0xBB f1 +0xBC f2 +0xBD f3 +0xBE f4 +0xBF f5 +0xC0 f6 +0xC1 f7 +0xC2 f8 +0xC3 f9 +0xC4 f10 +0xD7 f11 +0xD8 f12 + # Using F13-F21 for the .5 F keys right now. 0xF7 f13 diff --git a/extras/mobile-action-modeswitch/61-mobile-action.rules b/extras/mobile-action-modeswitch/61-mobile-action.rules deleted file mode 100644 index 0af27a5..0000000 --- a/extras/mobile-action-modeswitch/61-mobile-action.rules +++ /dev/null @@ -1,15 +0,0 @@ -ACTION!="add", GOTO="mobile_action_end" - -# ATTENTION: DO NOT USE THIS FILE FOR ANYTHING EXCEPT -# MOBILE ACTION CABLES. DO NOT USE IT FOR 3G DEVICES! - -SUBSYSTEM=="usb", ATTR{bDeviceClass}=="00|ff", ATTR{bDeviceSubClass}=="00|ff", ENV{DEVTYPE}=="usb_device", GOTO="mobile_action_switch" -GOTO="mobile_action_end" - -LABEL="mobile_action_switch" - -# Mobile Action cables like the 8280p and 8230p -ATTRS{idVendor}=="0df7", ATTRS{idProduct}=="0800", RUN+="mobile-action-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t mobile-action-8280p" - -LABEL="mobile_action_end" - diff --git a/extras/mobile-action-modeswitch/ma8280p_us.c b/extras/mobile-action-modeswitch/ma8280p_us.c deleted file mode 100644 index d7cf4f4..0000000 --- a/extras/mobile-action-modeswitch/ma8280p_us.c +++ /dev/null @@ -1,462 +0,0 @@ -/* http://www.natox.be/ma8280p/ - * http://www.leopold.dk/~martin/ma-8230p.html - * http://figvam.blogspot.com/2007/01/mobile-action-8730p-usb-cable-and-linux.html - */ - -/* - * - * Code by davy hollevoet. This is simply an adaptation of code - * generated by usbsnoop2libusb. (http://iki.fi/lindi/usb/usbsnoop2libusb.pl) - * - * This code is released under both the GPL version 2 and BSD licenses. - * Either license may be used. - * - * GPLv2 - * ******** - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * In addition: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * BSD - * ****** - * Copyright (c) 1998, Regents of the University of California - * All rights reserved. - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the University of California, Berkeley nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* This file is (mostly) generated with usbsnoop2libusb.pl from a usbsnoop log file. */ -/* Latest version of the script should be in http://iki.fi/lindi/usb/usbsnoop2libusb.pl */ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "utils.h" -#include "ma8280p_us.h" - -static void msleep(long msec) -{ - struct timespec duration = { 0, msec * 1000 * 1000 }; - - nanosleep(&duration, NULL); -} - -int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev) -{ - int ret = 1; - char *buf = NULL; - - buf = malloc (65535); - if (!buf) { - error ("%s: not enough memory", dev->filename, ret); - return -1; - } - - usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); - msleep(6); - usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); - msleep(6); - usb_get_descriptor(devh, 0x0000002, 0x0000000, buf, 0x0000400); - msleep(10); - ret = usb_release_interface(devh, 0); - if (ret != 0) - debug ("%s: failed to release interface before set_configuration: %d", dev->filename, ret); - usb_set_configuration(devh, 0x0000001); - ret = usb_claim_interface(devh, 0); - if (ret != 0) - debug ("%s: claim after set_configuration failed with error %d", dev->filename, ret); - //usb_set_altinterface(devh, 0); - //msleep(33); - usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE + USB_ENDPOINT_IN, 0x0000001, 0x0000300, 0x0000000, buf, 0x0000008, 1000); - msleep(5); - memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); - usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); - msleep(4); - memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); - usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); - msleep(4); - - msleep(4); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(6); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped - msleep(4); - memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(3); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(7); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(7); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(2); - //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped - msleep(4); - memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(2); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(7); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(7); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped - msleep(4); - memcpy(buf, "\x33\x04\xfe\x00\xf4\x6c\x1f\xf0", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(3); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped - msleep(4); - memcpy(buf, "\x32\x07\xfe\xf0\x29\xb9\x3a\xf0", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(3); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - - if (buf) - free (buf); - return 0; -} diff --git a/extras/mobile-action-modeswitch/ma8280p_us.h b/extras/mobile-action-modeswitch/ma8280p_us.h deleted file mode 100644 index bf0e304..0000000 --- a/extras/mobile-action-modeswitch/ma8280p_us.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Modem mode switcher - * - * Copyright (C) 2009 Dan Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details: - */ - -#ifndef __MA8280P_H__ -#define __MA8280P_H__ - -#include - -int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev); - -#endif /* __MA8280P_H__ */ diff --git a/extras/mobile-action-modeswitch/mobile-action-modeswitch.c b/extras/mobile-action-modeswitch/mobile-action-modeswitch.c deleted file mode 100644 index 36d7d81..0000000 --- a/extras/mobile-action-modeswitch/mobile-action-modeswitch.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Mobile action cable mode switcher - * - * Copyright (C) 2008 - 2010 Dan Williams - * Copyright (C) 2008 Peter Henn - * - * Heavily based on the 'ozerocdoff' tool by Peter Henn. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details: - */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "utils.h" - -#include "ma8280p_us.h" - -struct usb_dev_handle *handle = NULL; - -typedef struct usb_device * (*FindFunc) (int vid, int pid); -typedef int (*SwitchFunc) (struct usb_dev_handle *dh, struct usb_device *dev); - -typedef enum { - ST_UNKNOWN = 0, - ST_MA8280P -} SwitchType; - -typedef struct SwitchEntry { - SwitchType st; - const char *clopt; - FindFunc find_func; - SwitchFunc switch_func; -} SwitchEntry; - -static SwitchEntry switch_types[] = { - { ST_MA8280P, "mobile-action-8280p", NULL, ma8280p_switch }, - { ST_UNKNOWN, NULL, NULL } -}; - -static struct usb_device * -generic_find (int vid, int pid) -{ - struct usb_bus *bus; - struct usb_device *dev; - - for (bus = usb_get_busses(); bus; bus = bus->next) { - for (dev = bus->devices; dev; dev = dev->next) { - if (dev->descriptor.idVendor == vid && dev->descriptor.idProduct == pid) { - debug ("Found device '%s'", dev->filename); - return dev; - } - } - } - return NULL; -} - -static void -release_usb_device (int param) -{ - usb_release_interface (handle, 0); - usb_close (handle); -} - -static void -print_usage (void) -{ - printf ("Usage: mobile-action-modeswitch [-hdq] [-l ] -v -p -t \n" - " -h, --help show this help message\n" - " -v, --vendor target USB vendor ID\n" - " -p, --product target USB product ID\n" - " -t, --type type of switch to attempt, varies by device:\n" - " mobile-action-8280p - For Mobile Action 8xxxP USB cables\n" - " -l, --log log output to a file\n" - " -q, --quiet don't print anything to stdout\n" - " -d, --debug display debugging messages\n\n" - "Examples:\n" - " mobile-action-modeswitch -v 0x0df7 -p 0x8000 -t mobile-action-8280p\n"); -} - -static SwitchEntry * -parse_type (const char *s) -{ - SwitchEntry *entry = &switch_types[0]; - - while (entry->clopt) { - if (!strcmp (entry->clopt, s)) - return entry; - entry++; - } - - return NULL; -} - -static void -do_exit (int val) -{ - log_shutdown (); - exit (val); -} - -int main(int argc, char **argv) -{ - static struct option options[] = { - { "help", no_argument, NULL, 'h' }, - { "vendor", required_argument, NULL, 'v' }, - { "product", required_argument, NULL, 'p' }, - { "type", required_argument, NULL, 't' }, - { "log", required_argument, NULL, 'l' }, - { "debug", no_argument, NULL, 'd' }, - { "quiet", no_argument, NULL, 'q' }, - { NULL, 0, NULL, 0} - }; - - struct usb_device *dev; - int vid = 0, pid = 0; - const char *logpath = NULL; - char buffer[256]; - int ret, quiet = 0, debug = 0; - SwitchEntry *sentry = NULL; - - while (1) { - int option; - - option = getopt_long(argc, argv, "hv:p:l:t:dq", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'v': - vid = strtol (optarg, NULL, 0); - break; - case 'p': - pid = strtol (optarg, NULL, 0); - break; - case 't': - sentry = parse_type (optarg); - if (!sentry) { - error ("unknown switch type '%s'", optarg); - print_usage (); - exit (1); - } - break; - case 'l': - logpath = optarg; - break; - case 'q': - quiet = 1; - break; - case 'd': - debug = 1; - break; - case 'h': - default: - print_usage (); - exit (1); - } - } - - if (log_startup (logpath, debug, quiet)) { - fprintf (stderr, "Couldn't open/create logfile %s", logpath); - exit (2); - } - - if (!sentry) { - if (!quiet) - print_usage (); - else - error ("missing device switch type."); - do_exit (3); - } - - if (!vid || !pid) { - if (!quiet) - print_usage (); - else - error ("missing vendor and device IDs."); - do_exit (3); - } - - usb_init(); - - if (usb_find_busses() < 0) { - error ("no USB busses found."); - do_exit (4); - } - - if (usb_find_devices() < 0) { - error ("no USB devices found."); - do_exit (4); - } - - if (sentry->find_func) - dev = (*sentry->find_func) (vid, pid); - else - dev = generic_find (vid, pid); - if (dev == NULL) { - error ("no device found."); - do_exit (5); - } - - handle = usb_open (dev); - if (handle == NULL) { - error ("%s: could not access the device.", - dev->filename); - do_exit (6); - } - - /* detach running default driver */ - signal (SIGTERM, release_usb_device); - ret = usb_get_driver_np (handle, 0, buffer, sizeof (buffer)); - if (ret == 0) { - debug ("%s: found already attached driver '%s'", dev->filename, buffer); - - ret = usb_detach_kernel_driver_np (handle, 0); - if (ret != 0) { - debug ("%s: error: unable to detach current driver.", dev->filename); - usb_close (handle); - do_exit (7); - } - } - - ret = usb_claim_interface (handle, 0); - if (ret != 0) { - debug ("%s: couldn't claim device's USB interface: %d.", - dev->filename, ret); - usb_close (handle); - do_exit (8); - } - - ret = (*sentry->switch_func) (handle, dev); - if (ret < 0) { - debug ("%s: failed to switch device to serial mode.", dev->filename); - usb_release_interface (handle, 0); - usb_close (handle); - do_exit(9); - } - - usb_release_interface (handle, 0); - - ret = usb_close (handle); - if (ret < 0) - debug ("%s: failed to close the device.", dev->filename); - - do_exit (0); - return 0; -} diff --git a/extras/mobile-action-modeswitch/utils.c b/extras/mobile-action-modeswitch/utils.c deleted file mode 100644 index 37d0df4..0000000 --- a/extras/mobile-action-modeswitch/utils.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Modem mode switcher - * - * Copyright (C) 2009 Dan Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details: - */ - -#include -#include -#include -#include -#include -#include - -#include "utils.h" - -static int debug_on = 0; -static int quiet = 0; -FILE *logfile = NULL; - -void -do_log (int level, const char *fmt, ...) -{ - va_list args; - char buffer[1024]; - char tag = 'L'; - - if (level >= LOG_DBG && !debug_on) - return; - - va_start (args, fmt); - vsnprintf (buffer, sizeof (buffer), fmt, args); - va_end (args); - - if (level == LOG_ERR) - tag = 'E'; - else if (level == LOG_MSG) - tag = 'L'; - else if (level == LOG_DBG) - tag = 'D'; - - if (logfile) - fprintf (logfile, "%c: %s\n", tag, buffer); - if (!quiet) - fprintf ((level == LOG_ERR) ? stderr : stdout, "%c: %s\n", tag, buffer); -} - -int -log_startup (const char *path, int do_debug, int be_quiet) -{ - time_t t; - - quiet = be_quiet; - debug_on = do_debug; - - if (!path) - return 0; - - logfile = fopen (path, "a+"); - if (!logfile) - return 1; - - t = time (NULL); - message ("\n**** Started: %s\n", ctime (&t)); - return 0; -} - -void -log_shutdown (void) -{ - if (logfile) - fclose (logfile); -} - diff --git a/extras/mobile-action-modeswitch/utils.h b/extras/mobile-action-modeswitch/utils.h deleted file mode 100644 index 1ef557a..0000000 --- a/extras/mobile-action-modeswitch/utils.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Modem mode switcher - * - * Copyright (C) 2009 Dan Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details: - */ - -#ifndef __UTILS_H__ -#define __UTILS_H__ - -#define LOG_ERR 0 -#define LOG_MSG 1 -#define LOG_DBG 2 - -#define message(fmt, args...) do_log (LOG_MSG, fmt, ##args); -#define error(fmt, args...) do_log (LOG_ERR, fmt, ##args); -#define debug(fmt, args...) do_log (LOG_DBG, fmt, ##args); - -void do_log (int level, const char *fmt, ...); -int log_startup (const char *path, int do_debug, int be_quiet); -void log_shutdown (void); - -#endif /* __UTILS_H__ */ diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index f150e55..539807c 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -33,6 +33,8 @@ ENV{MATCHIFTYPE}="$attr{type}" ENV{MATCHADDR}=="52:54:00:*", GOTO="persistent_net_generator_end" # ignore VMWare virtual interfaces ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", GOTO="persistent_net_generator_end" +# ignore Hyper-V virtual interfaces +ENV{MATCHADDR}=="00:15:5d:*", GOTO="persistent_net_generator_end" # These vendors are known to violate the local MAC address assignment scheme # Interlan, DEC (UNIBUS or QBUS), Apollo, Cisco, Racal-Datacom diff --git a/extras/rule_generator/rule_generator.functions b/extras/rule_generator/rule_generator.functions index e2060a2..4bec27a 100644 --- a/extras/rule_generator/rule_generator.functions +++ b/extras/rule_generator/rule_generator.functions @@ -48,9 +48,10 @@ writeable() { # Create a lock file for the current rules file. lock_rules_file() { - [ -e /dev/.udev/ ] || return 0 + RUNDIR=$(udevadm info --run) + [ -e "$RUNDIR" ] || return 0 - RULES_LOCK="/dev/.udev/.lock-${RULES_FILE##*/}" + RULES_LOCK="$RUNDIR/.lock-${RULES_FILE##*/}" retry=30 while ! mkdir $RULES_LOCK 2> /dev/null; do @@ -71,7 +72,8 @@ unlock_rules_file() { # Choose the real rules file if it is writeable or a temporary file if not. # Both files should be checked later when looking for existing rules. choose_rules_file() { - local tmp_rules_file="/dev/.udev/tmp-rules--${RULES_FILE##*/}" + RUNDIR=$(udevadm info --run) + local tmp_rules_file="$RUNDIR/tmp-rules--${RULES_FILE##*/}" [ -e "$RULES_FILE" -o -e "$tmp_rules_file" ] || PRINT_HEADER=1 if writeable ${RULES_FILE%/*}; then diff --git a/extras/scsi_id/README b/extras/scsi_id/README new file mode 100644 index 0000000..9cfe739 --- /dev/null +++ b/extras/scsi_id/README @@ -0,0 +1,4 @@ +scsi_id - generate a SCSI unique identifier for a given SCSI device + +Please send questions, comments or patches to or +. diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 6c88265..26b92e3 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -199,6 +199,7 @@ static int get_file_options(struct udev *udev, */ buffer = malloc(MAX_BUFFER_LEN); if (!buffer) { + fclose(fd); err(udev, "can't allocate memory\n"); return -1; } @@ -509,13 +510,13 @@ static int set_inq_values(struct udev *udev, struct scsi_id_device *dev_scsi, co udev_util_encode_string(dev_scsi->vendor, vendor_enc_str, sizeof(vendor_enc_str)); udev_util_encode_string(dev_scsi->model, model_enc_str, sizeof(model_enc_str)); - udev_util_replace_whitespace(dev_scsi->vendor, vendor_str, sizeof(vendor_str)); - udev_util_replace_chars(vendor_str, NULL); - udev_util_replace_whitespace(dev_scsi->model, model_str, sizeof(model_str)); - udev_util_replace_chars(model_str, NULL); + util_replace_whitespace(dev_scsi->vendor, vendor_str, sizeof(vendor_str)); + util_replace_chars(vendor_str, NULL); + util_replace_whitespace(dev_scsi->model, model_str, sizeof(model_str)); + util_replace_chars(model_str, NULL); set_type(dev_scsi->type, type_str, sizeof(type_str)); - udev_util_replace_whitespace(dev_scsi->revision, revision_str, sizeof(revision_str)); - udev_util_replace_chars(revision_str, NULL); + util_replace_whitespace(dev_scsi->revision, revision_str, sizeof(revision_str)); + util_replace_chars(revision_str, NULL); return 0; } @@ -559,11 +560,11 @@ static int scsi_id(struct udev *udev, char *maj_min_dev) printf("ID_REVISION=%s\n", revision_str); printf("ID_TYPE=%s\n", type_str); if (dev_scsi.serial[0] != '\0') { - udev_util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); - udev_util_replace_chars(serial_str, NULL); + util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); + util_replace_chars(serial_str, NULL); printf("ID_SERIAL=%s\n", serial_str); - udev_util_replace_whitespace(dev_scsi.serial_short, serial_str, sizeof(serial_str)); - udev_util_replace_chars(serial_str, NULL); + util_replace_whitespace(dev_scsi.serial_short, serial_str, sizeof(serial_str)); + util_replace_chars(serial_str, NULL); printf("ID_SERIAL_SHORT=%s\n", serial_str); } if (dev_scsi.wwn[0] != '\0') { @@ -592,8 +593,8 @@ static int scsi_id(struct udev *udev, char *maj_min_dev) if (reformat_serial) { char serial_str[MAX_SERIAL_LEN]; - udev_util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); - udev_util_replace_chars(serial_str, NULL); + util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); + util_replace_chars(serial_str, NULL); printf("%s\n", serial_str); goto out; } diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 516a6f1..5cde9a5 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -141,13 +141,13 @@ static int sg_err_category_new(struct udev *udev, } return SG_ERR_CAT_SENSE; } - if (!host_status) { + if (host_status) { if ((host_status == DID_NO_CONNECT) || (host_status == DID_BUS_BUSY) || (host_status == DID_TIME_OUT)) return SG_ERR_CAT_TIMEOUT; } - if (!driver_status) { + if (driver_status) { if (driver_status == DRIVER_TIMEOUT) return SG_ERR_CAT_TIMEOUT; } @@ -322,8 +322,10 @@ static int scsi_inquiry(struct udev *udev, { INQUIRY_CMD, evpd, page, 0, buflen, 0 }; unsigned char sense[SENSE_BUFF_LEN]; void *io_buf; - int retval; + struct sg_io_v4 io_v4; + struct sg_io_hdr io_hdr; int retry = 3; /* rather random */ + int retval; if (buflen > SCSI_INQ_BUFF_LEN) { info(udev, "buflen %d too long\n", buflen); @@ -334,8 +336,6 @@ resend: dbg(udev, "%s evpd %d, page 0x%x\n", dev_scsi->kernel, evpd, page); if (dev_scsi->use_sg == 4) { - struct sg_io_v4 io_v4; - memset(&io_v4, 0, sizeof(struct sg_io_v4)); io_v4.guard = 'Q'; io_v4.protocol = BSG_PROTOCOL_SCSI; @@ -348,8 +348,6 @@ resend: io_v4.din_xferp = (uintptr_t)buf; io_buf = (void *)&io_v4; } else { - struct sg_io_hdr io_hdr; - memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); io_hdr.interface_id = 'S'; io_hdr.cmd_len = sizeof(inq_cmd); diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-udev-acl.rules similarity index 89% rename from extras/udev-acl/70-acl.rules rename to extras/udev-acl/70-udev-acl.rules index 0717d25..2dac283 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-udev-acl.rules @@ -6,8 +6,10 @@ ENV{MAJOR}=="", GOTO="acl_end" ACTION=="remove", GOTO="acl_apply" +# systemd replaces udev-acl entirely, skip if active +TEST=="/sys/fs/cgroup/systemd", TAG=="uaccess", GOTO="acl_end" + # PTP/MTP protocol devices, cameras, portable media players -SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="", ENV{DEVTYPE}=="usb_device", IMPORT{program}="usb_id --export %p" SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", TAG+="udev-acl" # digicams with proprietary protocol @@ -21,6 +23,7 @@ ENV{ID_HPLIP}=="1", TAG+="udev-acl" # optical drives SUBSYSTEM=="block", ENV{ID_CDROM}=="1", TAG+="udev-acl" +SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", TAG+="udev-acl" # sound devices SUBSYSTEM=="sound", TAG+="udev-acl" @@ -51,6 +54,9 @@ ENV{ID_SMARTCARD_READER}=="*?", TAG+="udev-acl" # PDA devices ENV{ID_PDA}=="*?", TAG+="udev-acl" +# Programmable remote control +ENV{ID_REMOTE_CONTROL}=="1", TAG+="udev-acl" + # joysticks SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG+="udev-acl" diff --git a/extras/udev-acl/udev-acl.c b/extras/udev-acl/udev-acl.c index 31e9991..41e2536 100644 --- a/extras/udev-acl/udev-acl.c +++ b/extras/udev-acl/udev-acl.c @@ -258,11 +258,6 @@ static int consolekit_called(const char *ck_action, uid_t *uid, uid_t *uid2, con u = u2; } break; - case ACTION_NONE: - break; - default: - g_assert_not_reached(); - break; } *remove_session_id = old_session; @@ -293,8 +288,10 @@ static void apply_acl_to_devices(uid_t uid, int add) if (device == NULL) continue; node = udev_device_get_devnode(device); - if (node == NULL) + if (node == NULL) { + udev_device_unref(device); continue; + } set_facl(node, uid, add); udev_device_unref(device); } @@ -364,7 +361,6 @@ int main (int argc, char* argv[]) break; case 'h': printf("Usage: udev-acl --action=ACTION [--device=DEVICEFILE] [--user=UID]\n\n"); - default: goto out; } } diff --git a/extras/v4l_id/60-persistent-v4l.rules b/extras/v4l_id/60-persistent-v4l.rules index b6e1313..edfd844 100644 --- a/extras/v4l_id/60-persistent-v4l.rules +++ b/extras/v4l_id/60-persistent-v4l.rules @@ -6,14 +6,14 @@ ENV{MAJOR}=="", GOTO="persistent_v4l_end" IMPORT{program}="v4l_id $tempnode" -SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" KERNEL=="video*", ENV{ID_SERIAL}=="?*", SYMLINK+="v4l/by-id/$env{ID_BUS}-$env{ID_SERIAL}-video-index$attr{index}" # check for valid "index" number TEST!="index", GOTO="persistent_v4l_end" ATTR{index}!="?*", GOTO="persistent_v4l_end" -IMPORT{program}="path_id %p" +IMPORT{builtin}="path_id" ENV{ID_PATH}=="?*", KERNEL=="video*|vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" ENV{ID_PATH}=="?*", KERNEL=="audio*", SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" diff --git a/extras/v4l_id/v4l_id.c b/extras/v4l_id/v4l_id.c index d530a6d..21cb328 100644 --- a/extras/v4l_id/v4l_id.c +++ b/extras/v4l_id/v4l_id.c @@ -28,7 +28,6 @@ #include #include #include -#include #include int main (int argc, char *argv[]) @@ -39,7 +38,6 @@ int main (int argc, char *argv[]) }; int fd; char *device; - struct video_capability v1cap; struct v4l2_capability v2cap; while (1) { @@ -82,19 +80,6 @@ int main (int argc, char *argv[]) if ((v2cap.capabilities & V4L2_CAP_RADIO) > 0) printf("radio:"); printf("\n"); - } else if (ioctl (fd, VIDIOCGCAP, &v1cap) == 0) { - printf("ID_V4L_VERSION=1\n"); - printf("ID_V4L_PRODUCT=%s\n", v1cap.name); - printf("ID_V4L_CAPABILITIES=:"); - if ((v1cap.type & VID_TYPE_CAPTURE) > 0) - printf("capture:"); - if ((v1cap.type & VID_TYPE_OVERLAY) > 0) - printf("video_overlay:"); - if (v1cap.audios > 0) - printf("audio:"); - if ((v1cap.type & VID_TYPE_TUNER) > 0) - printf("tuner:"); - printf("\n"); } close (fd); diff --git a/gtk-doc.make b/gtk-doc.make index 57fab98..1f75dfd 100644 --- a/gtk-doc.make +++ b/gtk-doc.make @@ -5,12 +5,12 @@ #################################### if GTK_DOC_USE_LIBTOOL -GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) +GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) GTKDOC_RUN = $(LIBTOOL) --mode=execute else -GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) +GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) GTKDOC_RUN = endif @@ -23,17 +23,19 @@ GPATH = $(srcdir) TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE) -EXTRA_DIST = \ +SETUP_FILES = \ $(content_files) \ - $(HTML_IMAGES) \ $(DOC_MAIN_SGML_FILE) \ $(DOC_MODULE)-sections.txt \ $(DOC_MODULE)-overrides.txt -DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \ - pdf-build.stamp \ - $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp \ - $(srcdir)/pdf.stamp +EXTRA_DIST = \ + $(HTML_IMAGES) \ + $(SETUP_FILES) + +DOC_STAMPS=setup-build.stamp scan-build.stamp tmpl-build.stamp sgml-build.stamp \ + html-build.stamp pdf-build.stamp \ + tmpl.stamp sgml.stamp html.stamp pdf.stamp SCANOBJ_FILES = \ $(DOC_MODULE).args \ @@ -70,22 +72,47 @@ docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) $(REPORT_FILES): sgml-build.stamp +#### setup #### + +setup-build.stamp: + -@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ + echo ' DOC Preparing build'; \ + files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \ + if test "x$$files" != "x" ; then \ + for file in $$files ; do \ + test -f $(abs_srcdir)/$$file && \ + cp -pu $(abs_srcdir)/$$file $(abs_builddir)/ || true; \ + done; \ + fi; \ + test -d $(abs_srcdir)/tmpl && \ + { cp -rp $(abs_srcdir)/tmpl $(abs_builddir)/; \ + chmod -R u+w $(abs_builddir)/tmpl; } \ + fi + @touch setup-build.stamp + #### scan #### scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) - @echo 'gtk-doc: Scanning header files' - @-chmod -R u+w $(srcdir) - @_source_dir='' ; for i in $(DOC_SOURCE_DIR) ; do \ + @echo ' DOC Scanning header files' + @_source_dir='' ; \ + for i in $(DOC_SOURCE_DIR) ; do \ _source_dir="$${_source_dir} --source-dir=$$i" ; \ - done ; \ - cd $(srcdir) && \ - gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES) - @if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \ - CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \ + done ; \ + gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES) + @if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \ + echo " DOC Introspecting gobjects"; \ + scanobj_options=""; \ + gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \ + if test "$(?)" = "0"; then \ + if test "x$(V)" = "x1"; then \ + scanobj_options="--verbose"; \ + fi; \ + fi; \ + CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \ + gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \ else \ - cd $(srcdir) ; \ for i in $(SCANOBJ_FILES) ; do \ - test -f $$i || touch $$i ; \ + test -f $$i || touch $$i ; \ done \ fi @touch scan-build.stamp @@ -95,10 +122,14 @@ $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE) #### templates #### -tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt - @echo 'gtk-doc: Rebuilding template files' - @-chmod -R u+w $(srcdir) - @cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS) +tmpl-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt + @echo ' DOC Rebuilding template files' + @gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS) + @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ + if test -w $(abs_srcdir) ; then \ + cp -rp $(abs_builddir)/tmpl $(abs_srcdir)/; \ + fi \ + fi @touch tmpl-build.stamp tmpl.stamp: tmpl-build.stamp @@ -110,13 +141,13 @@ $(srcdir)/tmpl/*.sgml: #### xml #### sgml-build.stamp: tmpl.stamp $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files) - @echo 'gtk-doc: Building XML' + @echo ' DOC Building XML' @-chmod -R u+w $(srcdir) - @_source_dir='' ; for i in $(DOC_SOURCE_DIR) ; do \ + @_source_dir='' ; \ + for i in $(DOC_SOURCE_DIR) ; do \ _source_dir="$${_source_dir} --source-dir=$$i" ; \ - done ; \ - cd $(srcdir) && \ - gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS) + done ; \ + gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS) @touch sgml-build.stamp sgml.stamp: sgml-build.stamp @@ -125,58 +156,79 @@ sgml.stamp: sgml-build.stamp #### html #### html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) - @echo 'gtk-doc: Building HTML' - @-chmod -R u+w $(srcdir) - @rm -rf $(srcdir)/html - @mkdir $(srcdir)/html + @echo ' DOC Building HTML' + @rm -rf html + @mkdir html @mkhtml_options=""; \ + gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \ + if test "$(?)" = "0"; then \ + if test "x$(V)" = "x1"; then \ + mkhtml_options="$$mkhtml_options --verbose"; \ + fi; \ + fi; \ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \ if test "$(?)" = "0"; then \ - mkhtml_options=--path="$(srcdir)"; \ + mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \ fi; \ - cd $(srcdir)/html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) - @test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html ) - @echo 'gtk-doc: Fixing cross-references' - @cd $(srcdir) && gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) + cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) + -@test "x$(HTML_IMAGES)" = "x" || \ + for file in $(HTML_IMAGES) ; do \ + if test -f $(abs_srcdir)/$$file ; then \ + cp $(abs_srcdir)/$$file $(abs_builddir)/html; \ + fi; \ + if test -f $(abs_builddir)/$$file ; then \ + cp $(abs_builddir)/$$file $(abs_builddir)/html; \ + fi; \ + done; + @echo ' DOC Fixing cross-references' + @gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) @touch html-build.stamp #### pdf #### pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) - @echo 'gtk-doc: Building PDF' - @-chmod -R u+w $(srcdir) - @rm -rf $(srcdir)/$(DOC_MODULE).pdf - @mkpdf_imgdirs=""; \ + @echo ' DOC Building PDF' + @rm -f $(DOC_MODULE).pdf + @mkpdf_options=""; \ + gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \ + if test "$(?)" = "0"; then \ + if test "x$(V)" = "x1"; then \ + mkpdf_options="$$mkpdf_options --verbose"; \ + fi; \ + fi; \ if test "x$(HTML_IMAGES)" != "x"; then \ for img in $(HTML_IMAGES); do \ part=`dirname $$img`; \ - echo $$mkpdf_imgdirs | grep >/dev/null "\-\-imgdir=$$part "; \ + echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \ if test $$? != 0; then \ - mkpdf_imgdirs="$$mkpdf_imgdirs --imgdir=$$part"; \ + mkpdf_options="$$mkpdf_options --imgdir=$$part"; \ fi; \ done; \ fi; \ - cd $(srcdir) && gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_imgdirs $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS) + gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS) @touch pdf-build.stamp ############## clean-local: - rm -f *~ *.bak - rm -rf .libs + @rm -f *~ *.bak + @rm -rf .libs distclean-local: - cd $(srcdir) && \ - rm -rf xml $(REPORT_FILES) $(DOC_MODULE).pdf \ - $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt + @rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \ + $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt + @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ + rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \ + rm -rf tmpl; \ + fi maintainer-clean-local: clean - cd $(srcdir) && rm -rf xml html + @rm -rf xml html install-data-local: - @installfiles=`echo $(srcdir)/html/*`; \ - if test "$$installfiles" = '$(srcdir)/html/*'; \ - then echo '-- Nothing to install' ; \ + @installfiles=`echo $(builddir)/html/*`; \ + if test "$$installfiles" = '$(builddir)/html/*'; \ + then echo 1>&2 'Nothing to install' ; \ else \ if test -n "$(DOC_MODULE_VERSION)"; then \ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ @@ -185,14 +237,12 @@ install-data-local: fi; \ $(mkinstalldirs) $${installdir} ; \ for i in $$installfiles; do \ - echo '-- Installing '$$i ; \ + echo ' $(INSTALL_DATA) '$$i ; \ $(INSTALL_DATA) $$i $${installdir}; \ done; \ if test -n "$(DOC_MODULE_VERSION)"; then \ mv -f $${installdir}/$(DOC_MODULE).devhelp2 \ $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \ - mv -f $${installdir}/$(DOC_MODULE).devhelp \ - $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp; \ fi; \ $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \ fi @@ -217,14 +267,14 @@ dist-check-gtkdoc: endif dist-hook: dist-check-gtkdoc dist-hook-local - mkdir $(distdir)/tmpl - mkdir $(distdir)/html - -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl - cp $(srcdir)/html/* $(distdir)/html - -cp $(srcdir)/$(DOC_MODULE).pdf $(distdir)/ - -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/ - -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/ - cd $(distdir) && rm -f $(DISTCLEANFILES) - $(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html + @mkdir $(distdir)/tmpl + @mkdir $(distdir)/html + @-cp ./tmpl/*.sgml $(distdir)/tmpl + @cp ./html/* $(distdir)/html + @-cp ./$(DOC_MODULE).pdf $(distdir)/ + @-cp ./$(DOC_MODULE).types $(distdir)/ + @-cp ./$(DOC_MODULE)-sections.txt $(distdir)/ + @cd $(distdir) && rm -f $(DISTCLEANFILES) + @$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html .PHONY : dist-hook-local docs diff --git a/init/udev-control.socket b/init/udev-control.socket new file mode 100644 index 0000000..858ddff --- /dev/null +++ b/init/udev-control.socket @@ -0,0 +1,8 @@ +[Unit] +Description=udev Control Socket +DefaultDependencies=no +ConditionCapability=CAP_MKNOD + +[Socket] +Service=udev.service +ListenSequentialPacket=/run/udev/control diff --git a/init/udev-kernel.socket b/init/udev-kernel.socket new file mode 100644 index 0000000..1c55453 --- /dev/null +++ b/init/udev-kernel.socket @@ -0,0 +1,9 @@ +[Unit] +Description=udev Kernel Socket +DefaultDependencies=no +ConditionCapability=CAP_MKNOD + +[Socket] +Service=udev.service +ReceiveBuffer=134217728 +ListenNetlink=kobject-uevent 1 diff --git a/init/udev-retry.service.in b/init/udev-retry.service.in deleted file mode 100644 index 9be0dfc..0000000 --- a/init/udev-retry.service.in +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=udev Retry Failed Events -DefaultDependencies=no -After=local-fs.target udev.service -Before=basic.target - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=@sbindir@/udevadm trigger --type=failed --action=add diff --git a/init/udev-settle.service.in b/init/udev-settle.service.in index c5d7e96..f5f5958 100644 --- a/init/udev-settle.service.in +++ b/init/udev-settle.service.in @@ -1,10 +1,25 @@ +# This service is usually not enabled by default. If enabled, it +# acts as a barrier for basic.target -- so all later services will +# wait for udev completely finishing its coldplug run. +# +# If needed, to work around broken or non-hotplug-aware services, +# it might be enabled unconditionally, or pulled-in on-demand by +# the services that assume a fully populated /dev at startup. It +# should not be used or pulled-in ever on systems without such +# legacy services running. + [Unit] Description=udev Wait for Complete Device Initialization DefaultDependencies=no -After=udev.service +Wants=udev.service +After=udev-trigger.service Before=basic.target [Service] Type=oneshot +TimeoutSec=180 RemainAfterExit=yes ExecStart=@sbindir@/udevadm settle + +[Install] +WantedBy=basic.target diff --git a/init/udev-trigger.service.in b/init/udev-trigger.service.in new file mode 100644 index 0000000..6d416c2 --- /dev/null +++ b/init/udev-trigger.service.in @@ -0,0 +1,10 @@ +[Unit] +Description=udev Coldplug all Devices +Wants=udev.service +After=udev-kernel.socket udev-control.socket +DefaultDependencies=no + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=@sbindir@/udevadm trigger --type=subsystems --action=add ; @sbindir@/udevadm trigger --type=devices --action=add diff --git a/init/udev.service.in b/init/udev.service.in index 908c8e9..0007218 100644 --- a/init/udev.service.in +++ b/init/udev.service.in @@ -1,9 +1,14 @@ [Unit] Description=udev Kernel Device Manager -DefaultDependencies=no +Wants=udev-control.socket udev-kernel.socket +After=udev-control.socket udev-kernel.socket Before=basic.target +DefaultDependencies=no +ConditionCapability=CAP_MKNOD [Service] Type=notify -ExecStart=@sbindir@/udevd -ExecStartPost=@sbindir@/udevadm trigger --type=subsystems --action=add ; @sbindir@/udevadm trigger --type=devices --action=add +OOMScoreAdjust=-1000 +Sockets=udev-control.socket udev-kernel.socket +Restart=on-failure +ExecStart=@libexecdir@/udevd diff --git a/libudev/docs/Makefile.in b/libudev/docs/Makefile.in index 0345c6f..aadef87 100644 --- a/libudev/docs/Makefile.in +++ b/libudev/docs/Makefile.in @@ -78,6 +78,7 @@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -94,6 +95,8 @@ GLIB_LIBS = @GLIB_LIBS@ GPERF = @GPERF@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ G_IR_COMPILER = @G_IR_COMPILER@ @@ -113,12 +116,11 @@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ -LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LIBS = @LIBUSB_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -153,6 +155,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -185,7 +188,6 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -283,10 +285,10 @@ expand_content_files = # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) GTKDOC_CFLAGS = GTKDOC_LIBS = -@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) +@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +@GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) +@GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_LD = $(LIBTOOL) --tag=CC --mode=link $(CC) $(GTKDOC_DEPS_LIBS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) @GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_RUN = @GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_RUN = $(LIBTOOL) --mode=execute @@ -297,18 +299,21 @@ GTKDOC_LIBS = # GPATH = $(srcdir) TARGET_DIR = $(HTML_DIR)/$(DOC_MODULE) +SETUP_FILES = \ + $(content_files) \ + $(DOC_MAIN_SGML_FILE) \ + $(DOC_MODULE)-sections.txt \ + $(DOC_MODULE)-overrides.txt + # This includes the standard gtk-doc make rules, copied by gtkdocize. # Other files to distribute # e.g. EXTRA_DIST += version.xml.in -EXTRA_DIST = $(content_files) $(HTML_IMAGES) $(DOC_MAIN_SGML_FILE) \ - $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt \ - version.xml.in -DOC_STAMPS = scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \ - pdf-build.stamp \ - $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp \ - $(srcdir)/pdf.stamp +EXTRA_DIST = $(HTML_IMAGES) $(SETUP_FILES) version.xml.in +DOC_STAMPS = setup-build.stamp scan-build.stamp tmpl-build.stamp sgml-build.stamp \ + html-build.stamp pdf-build.stamp \ + tmpl.stamp sgml.stamp html.stamp pdf.stamp SCANOBJ_FILES = \ $(DOC_MODULE).args \ @@ -529,22 +534,47 @@ docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) $(REPORT_FILES): sgml-build.stamp +#### setup #### + +setup-build.stamp: + -@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ + echo ' DOC Preparing build'; \ + files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \ + if test "x$$files" != "x" ; then \ + for file in $$files ; do \ + test -f $(abs_srcdir)/$$file && \ + cp -pu $(abs_srcdir)/$$file $(abs_builddir)/ || true; \ + done; \ + fi; \ + test -d $(abs_srcdir)/tmpl && \ + { cp -rp $(abs_srcdir)/tmpl $(abs_builddir)/; \ + chmod -R u+w $(abs_builddir)/tmpl; } \ + fi + @touch setup-build.stamp + #### scan #### scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) - @echo 'gtk-doc: Scanning header files' - @-chmod -R u+w $(srcdir) - @_source_dir='' ; for i in $(DOC_SOURCE_DIR) ; do \ + @echo ' DOC Scanning header files' + @_source_dir='' ; \ + for i in $(DOC_SOURCE_DIR) ; do \ _source_dir="$${_source_dir} --source-dir=$$i" ; \ - done ; \ - cd $(srcdir) && \ - gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES) - @if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \ - CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \ + done ; \ + gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES) + @if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \ + echo " DOC Introspecting gobjects"; \ + scanobj_options=""; \ + gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \ + if test "$(?)" = "0"; then \ + if test "x$(V)" = "x1"; then \ + scanobj_options="--verbose"; \ + fi; \ + fi; \ + CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" \ + gtkdoc-scangobj $(SCANGOBJ_OPTIONS) $$scanobj_options --module=$(DOC_MODULE); \ else \ - cd $(srcdir) ; \ for i in $(SCANOBJ_FILES) ; do \ - test -f $$i || touch $$i ; \ + test -f $$i || touch $$i ; \ done \ fi @touch scan-build.stamp @@ -554,10 +584,14 @@ $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE) #### templates #### -tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt - @echo 'gtk-doc: Rebuilding template files' - @-chmod -R u+w $(srcdir) - @cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS) +tmpl-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt + @echo ' DOC Rebuilding template files' + @gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS) + @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ + if test -w $(abs_srcdir) ; then \ + cp -rp $(abs_builddir)/tmpl $(abs_srcdir)/; \ + fi \ + fi @touch tmpl-build.stamp tmpl.stamp: tmpl-build.stamp @@ -569,13 +603,13 @@ $(srcdir)/tmpl/*.sgml: #### xml #### sgml-build.stamp: tmpl.stamp $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files) - @echo 'gtk-doc: Building XML' + @echo ' DOC Building XML' @-chmod -R u+w $(srcdir) - @_source_dir='' ; for i in $(DOC_SOURCE_DIR) ; do \ + @_source_dir='' ; \ + for i in $(DOC_SOURCE_DIR) ; do \ _source_dir="$${_source_dir} --source-dir=$$i" ; \ - done ; \ - cd $(srcdir) && \ - gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS) + done ; \ + gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS) @touch sgml-build.stamp sgml.stamp: sgml-build.stamp @@ -584,58 +618,79 @@ sgml.stamp: sgml-build.stamp #### html #### html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) - @echo 'gtk-doc: Building HTML' - @-chmod -R u+w $(srcdir) - @rm -rf $(srcdir)/html - @mkdir $(srcdir)/html + @echo ' DOC Building HTML' + @rm -rf html + @mkdir html @mkhtml_options=""; \ + gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \ + if test "$(?)" = "0"; then \ + if test "x$(V)" = "x1"; then \ + mkhtml_options="$$mkhtml_options --verbose"; \ + fi; \ + fi; \ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \ if test "$(?)" = "0"; then \ - mkhtml_options=--path="$(srcdir)"; \ + mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \ fi; \ - cd $(srcdir)/html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) - @test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html ) - @echo 'gtk-doc: Fixing cross-references' - @cd $(srcdir) && gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) + cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) + -@test "x$(HTML_IMAGES)" = "x" || \ + for file in $(HTML_IMAGES) ; do \ + if test -f $(abs_srcdir)/$$file ; then \ + cp $(abs_srcdir)/$$file $(abs_builddir)/html; \ + fi; \ + if test -f $(abs_builddir)/$$file ; then \ + cp $(abs_builddir)/$$file $(abs_builddir)/html; \ + fi; \ + done; + @echo ' DOC Fixing cross-references' + @gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) @touch html-build.stamp #### pdf #### pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) - @echo 'gtk-doc: Building PDF' - @-chmod -R u+w $(srcdir) - @rm -rf $(srcdir)/$(DOC_MODULE).pdf - @mkpdf_imgdirs=""; \ + @echo ' DOC Building PDF' + @rm -f $(DOC_MODULE).pdf + @mkpdf_options=""; \ + gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \ + if test "$(?)" = "0"; then \ + if test "x$(V)" = "x1"; then \ + mkpdf_options="$$mkpdf_options --verbose"; \ + fi; \ + fi; \ if test "x$(HTML_IMAGES)" != "x"; then \ for img in $(HTML_IMAGES); do \ part=`dirname $$img`; \ - echo $$mkpdf_imgdirs | grep >/dev/null "\-\-imgdir=$$part "; \ + echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \ if test $$? != 0; then \ - mkpdf_imgdirs="$$mkpdf_imgdirs --imgdir=$$part"; \ + mkpdf_options="$$mkpdf_options --imgdir=$$part"; \ fi; \ done; \ fi; \ - cd $(srcdir) && gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_imgdirs $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS) + gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS) @touch pdf-build.stamp ############## clean-local: - rm -f *~ *.bak - rm -rf .libs + @rm -f *~ *.bak + @rm -rf .libs distclean-local: - cd $(srcdir) && \ - rm -rf xml $(REPORT_FILES) $(DOC_MODULE).pdf \ - $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt + @rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \ + $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt + @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ + rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \ + rm -rf tmpl; \ + fi maintainer-clean-local: clean - cd $(srcdir) && rm -rf xml html + @rm -rf xml html install-data-local: - @installfiles=`echo $(srcdir)/html/*`; \ - if test "$$installfiles" = '$(srcdir)/html/*'; \ - then echo '-- Nothing to install' ; \ + @installfiles=`echo $(builddir)/html/*`; \ + if test "$$installfiles" = '$(builddir)/html/*'; \ + then echo 1>&2 'Nothing to install' ; \ else \ if test -n "$(DOC_MODULE_VERSION)"; then \ installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \ @@ -644,14 +699,12 @@ install-data-local: fi; \ $(mkinstalldirs) $${installdir} ; \ for i in $$installfiles; do \ - echo '-- Installing '$$i ; \ + echo ' $(INSTALL_DATA) '$$i ; \ $(INSTALL_DATA) $$i $${installdir}; \ done; \ if test -n "$(DOC_MODULE_VERSION)"; then \ mv -f $${installdir}/$(DOC_MODULE).devhelp2 \ $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \ - mv -f $${installdir}/$(DOC_MODULE).devhelp \ - $${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp; \ fi; \ $(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir}; \ fi @@ -673,15 +726,15 @@ uninstall-local: @ENABLE_GTK_DOC_FALSE@ @false dist-hook: dist-check-gtkdoc dist-hook-local - mkdir $(distdir)/tmpl - mkdir $(distdir)/html - -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl - cp $(srcdir)/html/* $(distdir)/html - -cp $(srcdir)/$(DOC_MODULE).pdf $(distdir)/ - -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/ - -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/ - cd $(distdir) && rm -f $(DISTCLEANFILES) - $(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html + @mkdir $(distdir)/tmpl + @mkdir $(distdir)/html + @-cp ./tmpl/*.sgml $(distdir)/tmpl + @cp ./html/* $(distdir)/html + @-cp ./$(DOC_MODULE).pdf $(distdir)/ + @-cp ./$(DOC_MODULE).types $(distdir)/ + @-cp ./$(DOC_MODULE)-sections.txt $(distdir)/ + @cd $(distdir) && rm -f $(DISTCLEANFILES) + @$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html .PHONY : dist-hook-local docs diff --git a/libudev/docs/html/api-index-full.html b/libudev/docs/html/api-index-full.html index 9eb5942..f6c8ccb 100644 --- a/libudev/docs/html/api-index-full.html +++ b/libudev/docs/html/api-index-full.html @@ -3,17 +3,17 @@ API Index - + - - + + - + @@ -43,7 +43,7 @@ U -
+

API Index

@@ -113,6 +113,10 @@
+udev_device_get_sysattr_list_entry, function in udev_device +
+
+
udev_device_get_sysattr_value, function in udev_device
@@ -141,6 +145,10 @@
+udev_device_has_tag, function in udev_device +
+
+
udev_device_new_from_devnum, function in udev_device
@@ -174,6 +182,10 @@
+udev_enumerate_add_match_parent, function in udev_enumerate +
+
+
udev_enumerate_add_match_property, function in udev_enumerate
@@ -243,6 +255,10 @@
+udev_get_run_path, function in udev +
+
+
udev_get_sys_path, function in udev
@@ -343,10 +359,6 @@
-udev_queue_get_failed_list_entry, function in udev_queue -
-
-
udev_queue_get_kernel_seqnum, function in udev_queue
@@ -413,9 +425,13 @@ udev_unref, function in udev
+
+udev_util_encode_string, function in udev_util +
+
+ Generated by GTK-Doc V1.18
\ No newline at end of file diff --git a/libudev/docs/html/ch01.html b/libudev/docs/html/ch01.html index fb31486..81fbaee 100644 --- a/libudev/docs/html/ch01.html +++ b/libudev/docs/html/ch01.html @@ -3,12 +3,12 @@ libudev - + - + @@ -19,9 +19,9 @@ libudev Reference Manual Next -
+

-libudev

+libudev
udev — libudev context @@ -41,10 +41,13 @@
udev_queue — access to currently active events
+
+udev_util — utils +
+ Generated by GTK-Doc V1.18
\ No newline at end of file diff --git a/libudev/docs/html/index.html b/libudev/docs/html/index.html index 03807ad..09e6920 100644 --- a/libudev/docs/html/index.html +++ b/libudev/docs/html/index.html @@ -3,20 +3,20 @@ libudev Reference Manual - + - + -
+
-

for libudev version 166 +

for libudev version 174

-
+

@@ -41,12 +41,15 @@
udev_queue — access to currently active events
+
+udev_util — utils +
API Index
+ Generated by GTK-Doc V1.18
\ No newline at end of file diff --git a/libudev/docs/html/index.sgml b/libudev/docs/html/index.sgml index 51f907b..7dc0659 100644 --- a/libudev/docs/html/index.sgml +++ b/libudev/docs/html/index.sgml @@ -11,6 +11,7 @@ + @@ -53,8 +54,10 @@ + + @@ -88,6 +91,7 @@ + @@ -108,6 +112,10 @@ - + + + + + diff --git a/libudev/docs/html/libudev-udev-device.html b/libudev/docs/html/libudev-udev-device.html index 55be7bd..62b47f9 100644 --- a/libudev/docs/html/libudev-udev-device.html +++ b/libudev/docs/html/libudev-udev-device.html @@ -3,12 +3,12 @@ udev_device - + - + @@ -26,7 +26,7 @@ Description -
+
@@ -35,7 +35,7 @@
-
+

Synopsis

struct              udev_device;
 struct udev_device * udev_device_ref                    (struct udev_device *udev_device);
@@ -77,12 +77,16 @@ const char *        char *        udev_device_get_action              (struct udev_device *udev_device);
 const char *        udev_device_get_sysattr_value       (struct udev_device *udev_device,
                                                          const char *sysattr);
-unsigned long long int  udev_device_get_seqnum          (struct udev_device *udev_device);
-unsigned long long int  udev_device_get_usec_since_initialized
+struct udev_list_entry * udev_device_get_sysattr_list_entry
                                                         (struct udev_device *udev_device);
+unsigned long long int udev_device_get_seqnum           (struct udev_device *udev_device);
+unsigned long long int udev_device_get_usec_since_initialized
+                                                        (struct udev_device *udev_device);
+int                 udev_device_has_tag                 (struct udev_device *udev_device,
+                                                         const char *tag);
 
-
+

Description

Representation of kernel sys devices. Devices are uniquely identified @@ -91,9 +95,9 @@ filesystem. Devices usually belong to a kernel subsystem, and and have a unique name inside that subsystem.

-
+

Details

-
+

struct udev_device

struct udev_device;

@@ -101,7 +105,7 @@ Opaque object representing one kernel sys device.


-
+

udev_device_ref ()

struct udev_device * udev_device_ref                    (struct udev_device *udev_device);

@@ -112,19 +116,17 @@ Take a reference of a udev device.

udev_device :

-udev device - +udev device

Returns :

- the passed udev device - +the passed udev device

-
+

udev_device_unref ()

void                udev_device_unref                   (struct udev_device *udev_device);

@@ -135,13 +137,12 @@ the resources of the device will be released.

udev_device :

-udev device - +udev device

-
+

udev_device_get_udev ()

struct udev *       udev_device_get_udev                (struct udev_device *udev_device);

@@ -152,19 +153,17 @@ Retrieve the udev library context the device was created with.

udev_device :

-udev device - +udev device

Returns :

- the udev library context - +the udev library context

-
+

udev_device_new_from_syspath ()

struct udev_device * udev_device_new_from_syspath       (struct udev *udev,
                                                          const char *syspath);
@@ -182,24 +181,21 @@ release the resources of the udev device.

udev :

-udev library context - +udev library context

syspath :

-sys device path including sys directory - +sys device path including sys directory

Returns :

- a new udev device, or NULL, if it does not exist - +a new udev device, or NULL, if it does not exist

-
+

udev_device_new_from_devnum ()

struct udev_device * udev_device_new_from_devnum        (struct udev *udev,
                                                          char type,
@@ -219,29 +215,25 @@ release the resources of the udev device.
 
 
 

udev :

-udev library context - +udev library context

type :

-char or block device - +char or block device

devnum :

-device major/minor number - +device major/minor number

Returns :

- a new udev device, or NULL, if it does not exist - +a new udev device, or NULL, if it does not exist

-
+

udev_device_new_from_subsystem_sysname ()

struct udev_device * udev_device_new_from_subsystem_sysname
                                                         (struct udev *udev,
@@ -261,29 +253,25 @@ release the resources of the udev device.
 
 
 

udev :

-udev library context - +udev library context

subsystem :

-the subsystem of the device - +the subsystem of the device

sysname :

-the name of the device - +the name of the device

Returns :

- a new udev device, or NULL, if it does not exist - +a new udev device, or NULL, if it does not exist

-
+

udev_device_new_from_environment ()

struct udev_device * udev_device_new_from_environment   (struct udev *udev);

@@ -301,19 +289,17 @@ release the resources of the udev device.

udev :

-udev library context - +udev library context

Returns :

- a new udev device, or NULL, if it does not exist - +a new udev device, or NULL, if it does not exist

-
+

udev_device_get_parent ()

struct udev_device * udev_device_get_parent             (struct udev_device *udev_device);

@@ -338,19 +324,17 @@ references.

udev_device :

-the device to start searching from - +the device to start searching from

Returns :

- a new udev device, or NULL, if it no parent exist. - +a new udev device, or NULL, if it no parent exist.

-
+

udev_device_get_parent_with_subsystem_devtype ()

struct udev_device * udev_device_get_parent_with_subsystem_devtype
                                                         (struct udev_device *udev_device,
@@ -379,29 +363,25 @@ references.
 
 
 

udev_device :

-udev device to start searching from - +udev device to start searching from

subsystem :

-the subsystem of the device - +the subsystem of the device

devtype :

-the type (DEVTYPE) of the device - +the type (DEVTYPE) of the device

Returns :

- a new udev device, or NULL if no matching parent exists. - +a new udev device, or NULL if no matching parent exists.

-
+

udev_device_get_devpath ()

const char *        udev_device_get_devpath             (struct udev_device *udev_device);

@@ -413,19 +393,17 @@ does not contain the sys mount point, and starts with a '/'.

udev_device :

-udev device - +udev device

Returns :

- the devpath of the udev device - +the devpath of the udev device

-
+

udev_device_get_subsystem ()

const char *        udev_device_get_subsystem           (struct udev_device *udev_device);

@@ -437,19 +415,17 @@ contain any "/".

udev_device :

-udev device - +udev device

Returns :

- the subsystem name of the udev device, or NULL if it can not be determined - +the subsystem name of the udev device, or NULL if it can not be determined

-
+

udev_device_get_devtype ()

const char *        udev_device_get_devtype             (struct udev_device *udev_device);

@@ -460,19 +436,17 @@ Retrieve the devtype string of the udev device.

udev_device :

-udev device - +udev device

Returns :

- the devtype name of the udev device, or NULL if it can not be determined - +the devtype name of the udev device, or NULL if it can not be determined

-
+

udev_device_get_syspath ()

const char *        udev_device_get_syspath             (struct udev_device *udev_device);

@@ -484,19 +458,17 @@ absolute path and starts with the sys mount point.

udev_device :

-udev device - +udev device

Returns :

- the sys path of the udev device - +the sys path of the udev device

-
+

udev_device_get_sysname ()

const char *        udev_device_get_sysname             (struct udev_device *udev_device);
@@ -504,19 +476,17 @@ absolute path and starts with the sys mount point. - + - +

udev_device :

udev device -udev device

Returns :

the sys name of the device device -the sys name of the device device

-
+

udev_device_get_sysnum ()

const char *        udev_device_get_sysnum              (struct udev_device *udev_device);
@@ -524,19 +494,17 @@ absolute path and starts with the sys mount point. - + - +

udev_device :

udev device -udev device

Returns :

the trailing number of of the device name -the trailing number of of the device name

-
+

udev_device_get_devnode ()

const char *        udev_device_get_devnode             (struct udev_device *udev_device);

@@ -548,19 +516,17 @@ The path is an absolute path, and starts with the device directory.

udev_device :

-udev device - +udev device

Returns :

- the device node file name of the udev device, or NULL if no device node exists - +the device node file name of the udev device, or NULL if no device node exists

-
+

udev_device_get_is_initialized ()

int                 udev_device_get_is_initialized      (struct udev_device *udev_device);

@@ -577,19 +543,17 @@ or network interfaces. All other devices return 1 here.

udev_device :

-udev device - +udev device

Returns :

- 1 if the device is set up. 0 otherwise. - +1 if the device is set up. 0 otherwise.

-
+

udev_device_get_devlinks_list_entry ()

struct udev_list_entry * udev_device_get_devlinks_list_entry
                                                         (struct udev_device *udev_device);
@@ -606,19 +570,17 @@ the device directory.

udev_device :

-udev device - +udev device

Returns :

- the first entry of the device node link list - +the first entry of the device node link list

-
+

udev_device_get_properties_list_entry ()

struct udev_list_entry * udev_device_get_properties_list_entry
                                                         (struct udev_device *udev_device);
@@ -634,19 +596,17 @@ the property value by udev_list_get_value().

udev_device :

-udev device - +udev device

Returns :

- the first entry of the property list - +the first entry of the property list

-
+

udev_device_get_tags_list_entry ()

struct udev_list_entry * udev_device_get_tags_list_entry
                                                         (struct udev_device *udev_device);
@@ -661,19 +621,17 @@ can be retrieved from the list entry by udev_list_get_nam

udev_device :

-udev device - +udev device

Returns :

- the first entry of the tag list - +the first entry of the tag list

-
+

udev_device_get_property_value ()

const char *        udev_device_get_property_value      (struct udev_device *udev_device,
                                                          const char *key);
@@ -682,24 +640,21 @@ can be retrieved from the list entry by udev_list_get_nam

udev_device :

-udev device - +udev device

key :

-property name - +property name

Returns :

- the value of a device property, or NULL if there is no such property. - +the value of a device property, or NULL if there is no such property.

-
+

udev_device_get_driver ()

const char *        udev_device_get_driver              (struct udev_device *udev_device);
@@ -707,43 +662,35 @@ can be retrieved from the list entry by udev_list_get_nam - + - +

udev_device :

udev device -udev device

Returns :

the driver string, or NULL if there is no driver attached. -the driver string, or NULL if there is no driver attached.

-
+

udev_device_get_devnum ()

dev_t               udev_device_get_devnum              (struct udev_device *udev_device);
-

-This is only valid if the device was received through a monitor. Devices read from -sys do not have a sequence number. -

- + - +

udev_device :

udev device -udev device

Returns :

the kernel event sequence number, or 0 if there is no sequence number available. -the device major/minor number.

-
+

udev_device_get_action ()

const char *        udev_device_get_action              (struct udev_device *udev_device);

@@ -756,19 +703,17 @@ offline.

udev_device :

-udev device - +udev device

Returns :

- the kernel action value, or NULL if there is no action value available. - +the kernel action value, or NULL if there is no action value available.

-
+

udev_device_get_sysattr_value ()

const char *        udev_device_get_sysattr_value       (struct udev_device *udev_device,
                                                          const char *sysattr);
@@ -781,48 +726,69 @@ value and not open the attribute again.

udev_device :

-udev device - +udev device

sysattr :

-attribute name - +attribute name

Returns :

- the content of a sys attribute file, or NULL if there is no sys attribute value. - +the content of a sys attribute file, or NULL if there is no sys attribute value. + + +
+
+
+
+

udev_device_get_sysattr_list_entry ()

+
struct udev_list_entry * udev_device_get_sysattr_list_entry
+                                                        (struct udev_device *udev_device);
+

+Retrieve the list of available sysattrs, with value being empty; +This just return all available sysfs attributes for a particular +device without reading their values. +

+
++ + + + + + + +

udev_device :

udev device

Returns :

the first entry of the property list

-
+

udev_device_get_seqnum ()

-
unsigned long long int  udev_device_get_seqnum          (struct udev_device *udev_device);
+
unsigned long long int udev_device_get_seqnum           (struct udev_device *udev_device);

+This is only valid if the device was received through a monitor. Devices read from +sys do not have a sequence number.

- + - +

udev_device :

-udev device

Returns :

-the kernel event sequence number, or 0 if there is no sequence number available.

-
+

udev_device_get_usec_since_initialized ()

-
unsigned long long int  udev_device_get_usec_since_initialized
+
unsigned long long int udev_device_get_usec_since_initialized
                                                         (struct udev_device *udev_device);

Return the number of microseconds passed since udev set up the @@ -837,21 +803,27 @@ in the udev database. All other devices return 0 here.

udev_device :

-udev device - +udev device

Returns :

- the number of microseconds since the device was first seen. - +the number of microseconds since the device was first seen.
+
+
+

udev_device_has_tag ()

+
int                 udev_device_has_tag                 (struct udev_device *udev_device,
+                                                         const char *tag);
+

+

+
+ Generated by GTK-Doc V1.18
\ No newline at end of file diff --git a/libudev/docs/html/libudev-udev-enumerate.html b/libudev/docs/html/libudev-udev-enumerate.html index 4583da9..650abf0 100644 --- a/libudev/docs/html/libudev-udev-enumerate.html +++ b/libudev/docs/html/libudev-udev-enumerate.html @@ -3,12 +3,12 @@ udev_enumerate - + - + @@ -26,7 +26,7 @@ Description -
+
@@ -35,7 +35,7 @@
-
+

Synopsis

struct              udev_enumerate;
 struct udev_enumerate * udev_enumerate_ref              (struct udev_enumerate *udev_enumerate);
@@ -58,6 +58,8 @@ struct const char *value);
 int                 udev_enumerate_add_match_tag        (struct udev_enumerate *udev_enumerate,
                                                          const char *tag);
+int                 udev_enumerate_add_match_parent     (struct udev_enumerate *udev_enumerate,
+                                                         struct udev_device *parent);
 int                 udev_enumerate_add_match_is_initialized
                                                         (struct udev_enumerate *udev_enumerate);
 int                 udev_enumerate_add_match_sysname    (struct udev_enumerate *udev_enumerate,
@@ -69,16 +71,16 @@ struct udev_list_entry * udev_enumerate_get_list_entry  (struct udev_enumerate *udev_enumerate);
 
-
+

Description

Lookup devices in the sys filesystem, filter devices by properties, and return a sorted list of devices.

-
+

Details

-
+

struct udev_enumerate

struct udev_enumerate;

@@ -86,7 +88,7 @@ Opaque object representing one device lookup/sort context.


-
+

udev_enumerate_ref ()

struct udev_enumerate * udev_enumerate_ref              (struct udev_enumerate *udev_enumerate);

@@ -97,19 +99,17 @@ Take a reference of a enumeration context.

udev_enumerate :

-context - +context

Returns :

- the passed enumeration context - +the passed enumeration context

-
+

udev_enumerate_unref ()

void                udev_enumerate_unref                (struct udev_enumerate *udev_enumerate);

@@ -120,13 +120,12 @@ all resources of the enumeration context will be released.

udev_enumerate :

-context - +context

-
+

udev_enumerate_get_udev ()

struct udev *       udev_enumerate_get_udev             (struct udev_enumerate *udev_enumerate);
@@ -134,19 +133,17 @@ all resources of the enumeration context will be released. - + - +

udev_enumerate :

context -context

Returns :

the udev library context. -the udev library context.

-
+

udev_enumerate_new ()

struct udev_enumerate * udev_enumerate_new              (struct udev *udev);
@@ -154,19 +151,17 @@ all resources of the enumeration context will be released. - + - +

udev :

udev library context -udev library context

Returns :

an enumeration context -an enumeration context

-
+

udev_enumerate_add_match_subsystem ()

int                 udev_enumerate_add_match_subsystem  (struct udev_enumerate *udev_enumerate,
                                                          const char *subsystem);
@@ -175,24 +170,21 @@ all resources of the enumeration context will be released.

udev_enumerate :

-context - +context

subsystem :

-filter for a subsystem of the device to include in the list - +filter for a subsystem of the device to include in the list

Returns :

- 0 on success, otherwise a negative error value. - +0 on success, otherwise a negative error value.

-
+

udev_enumerate_add_nomatch_subsystem ()

int                 udev_enumerate_add_nomatch_subsystem
                                                         (struct udev_enumerate *udev_enumerate,
@@ -202,24 +194,21 @@ all resources of the enumeration context will be released.
 
 
 

udev_enumerate :

-context - +context

subsystem :

-filter for a subsystem of the device to exclude from the list - +filter for a subsystem of the device to exclude from the list

Returns :

- 0 on success, otherwise a negative error value. - +0 on success, otherwise a negative error value.

-
+

udev_enumerate_add_match_sysattr ()

int                 udev_enumerate_add_match_sysattr    (struct udev_enumerate *udev_enumerate,
                                                          const char *sysattr,
@@ -229,29 +218,25 @@ all resources of the enumeration context will be released.
 
 
 

udev_enumerate :

-context - +context

sysattr :

-filter for a sys attribute at the device to include in the list - +filter for a sys attribute at the device to include in the list

value :

-optional value of the sys attribute - +optional value of the sys attribute

Returns :

- 0 on success, otherwise a negative error value. - +0 on success, otherwise a negative error value.

-
+

udev_enumerate_add_nomatch_sysattr ()

int                 udev_enumerate_add_nomatch_sysattr  (struct udev_enumerate *udev_enumerate,
                                                          const char *sysattr,
@@ -261,29 +246,25 @@ all resources of the enumeration context will be released.
 
 
 

udev_enumerate :

-context - +context

sysattr :

-filter for a sys attribute at the device to exclude from the list - +filter for a sys attribute at the device to exclude from the list

value :

-optional value of the sys attribute - +optional value of the sys attribute

Returns :

- 0 on success, otherwise a negative error value. - +0 on success, otherwise a negative error value.

-
+

udev_enumerate_add_match_property ()

int                 udev_enumerate_add_match_property   (struct udev_enumerate *udev_enumerate,
                                                          const char *property,
@@ -293,29 +274,25 @@ all resources of the enumeration context will be released.
 
 
 

udev_enumerate :

-context - +context

property :

-filter for a property of the device to include in the list - +filter for a property of the device to include in the list

value :

-value of the property - +value of the property

Returns :

- 0 on success, otherwise a negative error value. - +0 on success, otherwise a negative error value.

-
+

udev_enumerate_add_match_tag ()

int                 udev_enumerate_add_match_tag        (struct udev_enumerate *udev_enumerate,
                                                          const char *tag);
@@ -324,24 +301,52 @@ all resources of the enumeration context will be released.

udev_enumerate :

-context - +context

tag :

-filter for a tag of the device to include in the list - +filter for a tag of the device to include in the list

Returns :

- 0 on success, otherwise a negative error value. - +0 on success, otherwise a negative error value.

-
+
+

udev_enumerate_add_match_parent ()

+
int                 udev_enumerate_add_match_parent     (struct udev_enumerate *udev_enumerate,
+                                                         struct udev_device *parent);
+

+Return the devices on the subtree of one given device. The parent +itself is included in the list. +

+

+A reference for the device is held until the udev_enumerate context +is cleaned up. +

+
++ + + + + + + + + + + + + + +

udev_enumerate :

context

parent :

parent device where to start searching

Returns :

0 on success, otherwise a negative error value.
+
+
+

udev_enumerate_add_match_is_initialized ()

int                 udev_enumerate_add_match_is_initialized
                                                         (struct udev_enumerate *udev_enumerate);
@@ -365,19 +370,17 @@ and are not network interfaces.

udev_enumerate :

-context - +context

Returns :

- 0 on success, otherwise a negative error value. - +0 on success, otherwise a negative error value.

-
+

udev_enumerate_add_match_sysname ()

int                 udev_enumerate_add_match_sysname    (struct udev_enumerate *udev_enumerate,
                                                          const char *sysname);
@@ -386,24 +389,21 @@ and are not network interfaces.

udev_enumerate :

-context - +context

sysname :

-filter for the name of the device to include in the list - +filter for the name of the device to include in the list

Returns :

- 0 on success, otherwise a negative error value. - +0 on success, otherwise a negative error value.

-
+

udev_enumerate_add_syspath ()

int                 udev_enumerate_add_syspath          (struct udev_enumerate *udev_enumerate,
                                                          const char *syspath);
@@ -415,24 +415,21 @@ Add a device to the list of devices, to retrieve it back sorted in dependency or

udev_enumerate :

-context - +context

syspath :

-path of a device - +path of a device

Returns :

- 0 on success, otherwise a negative error value. - +0 on success, otherwise a negative error value.

-
+

udev_enumerate_scan_devices ()

int                 udev_enumerate_scan_devices         (struct udev_enumerate *udev_enumerate);
@@ -440,19 +437,17 @@ Add a device to the list of devices, to retrieve it back sorted in dependency or - + - +

udev_enumerate :

udev enumeration context -udev enumeration context

Returns :

0 on success, otherwise a negative error value. -0 on success, otherwise a negative error value.

-
+

udev_enumerate_scan_subsystems ()

int                 udev_enumerate_scan_subsystems      (struct udev_enumerate *udev_enumerate);
@@ -460,19 +455,17 @@ Add a device to the list of devices, to retrieve it back sorted in dependency or - + - +

udev_enumerate :

udev enumeration context -udev enumeration context

Returns :

0 on success, otherwise a negative error value. -0 on success, otherwise a negative error value.

-
+

udev_enumerate_get_list_entry ()

struct udev_list_entry * udev_enumerate_get_list_entry  (struct udev_enumerate *udev_enumerate);
@@ -480,13 +473,11 @@ Add a device to the list of devices, to retrieve it back sorted in dependency or - + - +

udev_enumerate :

context -context

Returns :

the first entry of the sorted list of device paths. -the first entry of the sorted list of device paths.
@@ -495,6 +486,6 @@ Add a device to the list of devices, to retrieve it back sorted in dependency or
+ Generated by GTK-Doc V1.18
\ No newline at end of file diff --git a/libudev/docs/html/libudev-udev-list.html b/libudev/docs/html/libudev-udev-list.html index d759ce2..f2de789 100644 --- a/libudev/docs/html/libudev-udev-list.html +++ b/libudev/docs/html/libudev-udev-list.html @@ -3,12 +3,12 @@ udev_list - + - + @@ -26,7 +26,7 @@ Description -
+
@@ -35,7 +35,7 @@
-
+

Synopsis

struct              udev_list_entry;
 struct udev_list_entry * udev_list_entry_get_next       (struct udev_list_entry *list_entry);
@@ -47,15 +47,15 @@ const char *        
+

Description

Libudev list operations.

-
+

Details

-
+

struct udev_list_entry

struct udev_list_entry;

@@ -64,7 +64,7 @@ contains a name, and optionally a value.


-
+

udev_list_entry_get_next ()

struct udev_list_entry * udev_list_entry_get_next       (struct udev_list_entry *list_entry);
@@ -72,19 +72,17 @@ contains a name, and optionally a value. - + - +

list_entry :

current entry -current entry

Returns :

the next entry from the list, NULL is no more entries are found. -the next entry from the list, NULL is no more entries are found.

-
+

udev_list_entry_get_by_name ()

struct udev_list_entry * udev_list_entry_get_by_name    (struct udev_list_entry *list_entry,
                                                          const char *name);
@@ -93,24 +91,21 @@ contains a name, and optionally a value.

list_entry :

-current entry - +current entry

name :

-name string to match - +name string to match

Returns :

- the entry where name matched, NULL if no matching entry is found. - +the entry where name matched, NULL if no matching entry is found.

-
+

udev_list_entry_get_name ()

const char *        udev_list_entry_get_name            (struct udev_list_entry *list_entry);
@@ -118,19 +113,17 @@ contains a name, and optionally a value. - + - +

list_entry :

current entry -current entry

Returns :

the name string of this entry. -the name string of this entry.

-
+

udev_list_entry_get_value ()

const char *        udev_list_entry_get_value           (struct udev_list_entry *list_entry);
@@ -138,19 +131,17 @@ contains a name, and optionally a value. - + - +

list_entry :

current entry -current entry

Returns :

the value string of this entry. -the value string of this entry.

-
+

udev_list_entry_foreach()

#define             udev_list_entry_foreach(list_entry, first_entry)

@@ -161,13 +152,11 @@ Helper to iterate over all entries of a list.

list_entry :

-entry to store the current position - +entry to store the current position

first_entry :

-first entry to start with - +first entry to start with
@@ -176,6 +165,6 @@ Helper to iterate over all entries of a list.
+ Generated by GTK-Doc V1.18
\ No newline at end of file diff --git a/libudev/docs/html/libudev-udev-monitor.html b/libudev/docs/html/libudev-udev-monitor.html index e02fabd..2ac6167 100644 --- a/libudev/docs/html/libudev-udev-monitor.html +++ b/libudev/docs/html/libudev-udev-monitor.html @@ -3,12 +3,12 @@ udev_monitor - + - + @@ -26,7 +26,7 @@ Description -
+
@@ -35,7 +35,7 @@
-
+

Synopsis

struct              udev_monitor;
 struct udev_monitor * udev_monitor_ref                  (struct udev_monitor *udev_monitor);
@@ -61,23 +61,23 @@ struct int                 udev_monitor_filter_remove          (struct udev_monitor *udev_monitor);
 
-
+

Description

Connects to a device event source.

-
+

Details

-
+

struct udev_monitor

struct udev_monitor;

-Opaque object handling one event source. +Opaque object handling an event source.


-
+

udev_monitor_ref ()

struct udev_monitor * udev_monitor_ref                  (struct udev_monitor *udev_monitor);

@@ -88,19 +88,17 @@ Take a reference of a udev monitor.

udev_monitor :

-udev monitor - +udev monitor

Returns :

- the passed udev monitor - +the passed udev monitor

-
+

udev_monitor_unref ()

void                udev_monitor_unref                  (struct udev_monitor *udev_monitor);

@@ -112,13 +110,12 @@ will be released.

udev_monitor :

-udev monitor - +udev monitor

-
+

udev_monitor_get_udev ()

struct udev *       udev_monitor_get_udev               (struct udev_monitor *udev_monitor);

@@ -129,19 +126,17 @@ Retrieve the udev library context the monitor was created with.

udev_monitor :

-udev monitor - +udev monitor

Returns :

- the udev library context - +the udev library context

-
+

udev_monitor_new_from_netlink ()

struct udev_monitor * udev_monitor_new_from_netlink     (struct udev *udev,
                                                          const char *name);
@@ -153,16 +148,11 @@ source. Valid sources identifiers are "udev" and "kernel". Applications should usually not connect directly to the "kernel" events, because the devices might not be useable at that time, before udev has configured them, and created -device nodes. -

-

-Accessing devices at the same time as udev, might result -in unpredictable behavior. -

-

-The "udev" events are sent out after udev has finished its -event processing, all rules have been processed, and needed -device nodes are created. +device nodes. Accessing devices at the same time as udev, +might result in unpredictable behavior. The "udev" events +are sent out after udev has finished its event processing, +all rules have been processed, and needed device nodes are +created.

The initial refcount is 1, and needs to be decremented to @@ -173,29 +163,32 @@ release the resources of the udev monitor.

udev :

-udev library context - +udev library context

name :

-name of event source - +name of event source

Returns :

- a new udev monitor, or NULL, in case of an error - +a new udev monitor, or NULL, in case of an error

-
+

udev_monitor_new_from_socket ()

struct udev_monitor * udev_monitor_new_from_socket      (struct udev *udev,
                                                          const char *socket_path);

-Create new udev monitor and connect to a specified socket. The +This function should not be used in any new application. The +kernel's netlink socket multiplexes messages to all interested +clients. Creating custom sockets from udev to applications +should be avoided. +

+

+Create a new udev monitor and connect to a specified socket. The path to a socket either points to an existing socket file, or if the socket path starts with a '@' character, an abstract namespace socket will be used. @@ -215,24 +208,21 @@ release the resources of the udev monitor.

udev :

-udev library context - +udev library context

socket_path :

-unix socket path - +unix socket path

Returns :

- a new udev monitor, or NULL, in case of an error - +a new udev monitor, or NULL, in case of an error

-
+

udev_monitor_enable_receiving ()

int                 udev_monitor_enable_receiving       (struct udev_monitor *udev_monitor);

@@ -243,19 +233,17 @@ Binds the udev_monitor socket to the eve

udev_monitor :

-the monitor which should receive events - +the monitor which should receive events

Returns :

- 0 on success, otherwise a negative error value. - +0 on success, otherwise a negative error value.

-
+

udev_monitor_set_receive_buffer_size ()

int                 udev_monitor_set_receive_buffer_size
                                                         (struct udev_monitor *udev_monitor,
@@ -269,24 +257,21 @@ appropriate privileges to succeed.
 
 
 

udev_monitor :

-the monitor which should receive events - +the monitor which should receive events

size :

-the size in bytes - +the size in bytes

Returns :

- 0 on success, otherwise -1 on error. - +0 on success, otherwise -1 on error.

-
+

udev_monitor_get_fd ()

int                 udev_monitor_get_fd                 (struct udev_monitor *udev_monitor);

@@ -297,19 +282,17 @@ Retrieve the socket file descriptor associated with the monitor.

udev_monitor :

-udev monitor - +udev monitor

Returns :

- the socket file descriptor - +the socket file descriptor

-
+

udev_monitor_receive_device ()

struct udev_device * udev_monitor_receive_device        (struct udev_monitor *udev_monitor);

@@ -317,9 +300,7 @@ Receive data from the udev monitor socket, allocate a new udev device, fill in the received data, and return the device.

-Only socket connections with uid=0 are accepted. The caller -needs to make sure that there is data to read from the socket. -The call will block until the socket becomes readable. +Only socket connections with uid=0 are accepted.

The initial refcount is 1, and needs to be decremented to @@ -330,26 +311,24 @@ release the resources of the udev device.

udev_monitor :

-udev monitor - +udev monitor

Returns :

- a new udev device, or NULL, in case of an error - +a new udev device, or NULL, in case of an error

-
+

udev_monitor_filter_add_match_subsystem_devtype ()

int                 udev_monitor_filter_add_match_subsystem_devtype
                                                         (struct udev_monitor *udev_monitor,
                                                          const char *subsystem,
                                                          const char *devtype);

-This filer is efficiently executed inside the kernel, and libudev subscribers +This filter is efficiently executed inside the kernel, and libudev subscribers will usually not be woken up for devices which do not match.

@@ -360,34 +339,30 @@ The filter must be installed before the monitor is switched to listening mode.

udev_monitor :

-the monitor - +the monitor

subsystem :

-the subsystem value to match the incoming devices against - +the subsystem value to match the incoming devices against

devtype :

-the devtype value to match the incoming devices against - +the devtype value to match the incoming devices against

Returns :

- 0 on success, otherwise a negative error value. - +0 on success, otherwise a negative error value.

-
+

udev_monitor_filter_add_match_tag ()

int                 udev_monitor_filter_add_match_tag   (struct udev_monitor *udev_monitor,
                                                          const char *tag);

-This filer is efficiently executed inside the kernel, and libudev subscribers +This filter is efficiently executed inside the kernel, and libudev subscribers will usually not be woken up for devices which do not match.

@@ -398,47 +373,43 @@ The filter must be installed before the monitor is switched to listening mode.

udev_monitor :

-the monitor - +the monitor

tag :

-the name of a tag - +the name of a tag

Returns :

- 0 on success, otherwise a negative error value. - +0 on success, otherwise a negative error value.

-
+

udev_monitor_filter_update ()

int                 udev_monitor_filter_update          (struct udev_monitor *udev_monitor);

-Update the installed filter. This might only be needed, if the filter was removed or changed. +Update the installed socket filter. This is only needed, +if the filter was removed or changed.

- + - +

udev_monitor :

monitor -monitor

Returns :

0 on success, otherwise a negative error value. -0 on success, otherwise a negative error value.

-
+

udev_monitor_filter_remove ()

int                 udev_monitor_filter_remove          (struct udev_monitor *udev_monitor);

@@ -449,13 +420,11 @@ Remove all filters from monitor.

udev_monitor :

-monitor - +monitor

Returns :

- 0 on success, otherwise a negative error value. - +0 on success, otherwise a negative error value.
@@ -464,6 +433,6 @@ Remove all filters from monitor.
+ Generated by GTK-Doc V1.18
\ No newline at end of file diff --git a/libudev/docs/html/libudev-udev-queue.html b/libudev/docs/html/libudev-udev-queue.html index 2947697..b2ba817 100644 --- a/libudev/docs/html/libudev-udev-queue.html +++ b/libudev/docs/html/libudev-udev-queue.html @@ -3,12 +3,12 @@ udev_queue - + - - + + @@ -18,7 +18,7 @@ Up Home libudev Reference Manual -Next +Next Top @@ -26,7 +26,7 @@ Description -
+
@@ -35,7 +35,7 @@
-
+

Synopsis

struct              udev_queue;
 struct udev_queue * udev_queue_ref                      (struct udev_queue *udev_queue);
@@ -45,20 +45,18 @@ struct int                 udev_queue_get_udev_is_active       (struct udev_queue *udev_queue);
 int                 udev_queue_get_queue_is_empty       (struct udev_queue *udev_queue);
 int                 udev_queue_get_seqnum_is_finished   (struct udev_queue *udev_queue,
-                                                         long int seqnum);
+                                                         unsigned long long int seqnum);
 int                 udev_queue_get_seqnum_sequence_is_finished
                                                         (struct udev_queue *udev_queue,
-                                                         long int start,
-                                                         long int end);
+                                                         unsigned long long int start,
+                                                         unsigned long long int end);
 struct udev_list_entry * udev_queue_get_queued_list_entry
                                                         (struct udev_queue *udev_queue);
-struct udev_list_entry * udev_queue_get_failed_list_entry
-                                                        (struct udev_queue *udev_queue);
-unsigned long long int  udev_queue_get_kernel_seqnum    (struct udev_queue *udev_queue);
-unsigned long long int  udev_queue_get_udev_seqnum      (struct udev_queue *udev_queue);
+unsigned long long int udev_queue_get_kernel_seqnum     (struct udev_queue *udev_queue);
+unsigned long long int udev_queue_get_udev_seqnum       (struct udev_queue *udev_queue);
 
-
+

Description

The udev daemon processes events asynchronously. All events which do not have @@ -67,9 +65,9 @@ event processing queue, and the current event sequence numbers from the kernel and the udev daemon.

-
+

Details

-
+

struct udev_queue

struct udev_queue;

@@ -77,7 +75,7 @@ Opaque object representing the current event queue in the udev daemon.


-
+

udev_queue_ref ()

struct udev_queue * udev_queue_ref                      (struct udev_queue *udev_queue);

@@ -88,19 +86,17 @@ Take a reference of a udev queue context.

udev_queue :

-udev queue context - +udev queue context

Returns :

- the same udev queue context. - +the same udev queue context.

-
+

udev_queue_unref ()

void                udev_queue_unref                    (struct udev_queue *udev_queue);

@@ -111,13 +107,12 @@ the resources of the queue context will be released.

udev_queue :

-udev queue context - +udev queue context

-
+

udev_queue_get_udev ()

struct udev *       udev_queue_get_udev                 (struct udev_queue *udev_queue);

@@ -128,19 +123,17 @@ Retrieve the udev library context the queue context was created with.

udev_queue :

-udev queue context - +udev queue context

Returns :

- the udev library context. - +the udev library context.

-
+

udev_queue_new ()

struct udev_queue * udev_queue_new                      (struct udev *udev);

@@ -152,19 +145,17 @@ release the resources of the udev queue context.

udev :

-udev library context - +udev library context

Returns :

- the udev queue context, or NULL on error. - +the udev queue context, or NULL on error.

-
+

udev_queue_get_udev_is_active ()

int                 udev_queue_get_udev_is_active       (struct udev_queue *udev_queue);
@@ -172,19 +163,17 @@ release the resources of the udev queue context. - + - +

udev_queue :

udev queue context -udev queue context

Returns :

a flag indicating if udev is active. -a flag indicating if udev is active.

-
+

udev_queue_get_queue_is_empty ()

int                 udev_queue_get_queue_is_empty       (struct udev_queue *udev_queue);
@@ -192,78 +181,69 @@ release the resources of the udev queue context. - + - +

udev_queue :

udev queue context -udev queue context

Returns :

a flag indicating if udev is currently handling events. -a flag indicating if udev is currently handling events.

-
+

udev_queue_get_seqnum_is_finished ()

int                 udev_queue_get_seqnum_is_finished   (struct udev_queue *udev_queue,
-                                                         long int seqnum);
+ unsigned long long int seqnum);
- + - + - +

udev_queue :

udev queue context -udev queue context

seqnum :

sequence number -sequence number

Returns :

a flag indicating if the given sequence number is handled. -a flag indicating if the given sequence number is currently active.

-
+

udev_queue_get_seqnum_sequence_is_finished ()

int                 udev_queue_get_seqnum_sequence_is_finished
                                                         (struct udev_queue *udev_queue,
-                                                         long int start,
-                                                         long int end);
+ unsigned long long int start, + unsigned long long int end);
- + - + - + - +

udev_queue :

udev queue context -udev queue context

start :

first event sequence number -first event sequence number

end :

last event sequence number -last event sequence number

Returns :

if any of the sequence numbers in the given range is currently active. -a flag indicating if any of the sequence numbers in the given range is currently active.

-
+

udev_queue_get_queued_list_entry ()

struct udev_list_entry * udev_queue_get_queued_list_entry
                                                         (struct udev_queue *udev_queue);
@@ -272,74 +252,47 @@ release the resources of the udev queue context.

udev_queue :

-udev queue context - +udev queue context

Returns :

- the first entry of the list of queued events. - +the first entry of the list of queued events.

-
-

udev_queue_get_failed_list_entry ()

-
struct udev_list_entry * udev_queue_get_failed_list_entry
-                                                        (struct udev_queue *udev_queue);
-
-- - - - - - - - - - -

udev_queue :

udev queue context -

Returns :

the first entry of the list of recorded failed events. -
-
-
-
+

udev_queue_get_kernel_seqnum ()

-
unsigned long long int  udev_queue_get_kernel_seqnum    (struct udev_queue *udev_queue);
+
unsigned long long int udev_queue_get_kernel_seqnum     (struct udev_queue *udev_queue);
- + - +

udev_queue :

udev queue context -udev queue context

Returns :

the current kernel event sequence number. -the current kernel event sequence number.

-
+

udev_queue_get_udev_seqnum ()

-
unsigned long long int  udev_queue_get_udev_seqnum      (struct udev_queue *udev_queue);
+
unsigned long long int udev_queue_get_udev_seqnum       (struct udev_queue *udev_queue);
- + - +

udev_queue :

udev queue context -udev queue context

Returns :

the last known udev event sequence number. -the last known udev event sequence number.
@@ -348,6 +301,6 @@ release the resources of the udev queue context.
+ Generated by GTK-Doc V1.18
\ No newline at end of file diff --git a/libudev/docs/html/libudev-udev-util.html b/libudev/docs/html/libudev-udev-util.html new file mode 100644 index 0000000..5be9f60 --- /dev/null +++ b/libudev/docs/html/libudev-udev-util.html @@ -0,0 +1,88 @@ + + + + +udev_util + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

udev_util

+

udev_util — utils

+
+
+

Synopsis

+
int                 udev_util_encode_string             (const char *str,
+                                                         char *str_enc,
+                                                         size_t len);
+
+
+
+

Description

+
+
+

Details

+
+

udev_util_encode_string ()

+
int                 udev_util_encode_string             (const char *str,
+                                                         char *str_enc,
+                                                         size_t len);
+

+Encode all potentially unsafe characters of a string to the +corresponding 2 char hex value prefixed by '\x'. +

+
++ + + + + + + + + + + + + + + + + + +

str :

input string to be encoded

str_enc :

output string to store the encoded input string

len :

maximum size of the output string, which may be +four times as long as the input string

Returns :

0 if the entire string was copied, non-zero otherwise.
+
+
+
+ + + \ No newline at end of file diff --git a/libudev/docs/html/libudev-udev.html b/libudev/docs/html/libudev-udev.html index c61903d..b74f590 100644 --- a/libudev/docs/html/libudev-udev.html +++ b/libudev/docs/html/libudev-udev.html @@ -3,12 +3,12 @@ udev - + - + @@ -26,7 +26,7 @@ Description -
+
@@ -35,34 +35,35 @@
-
+

Synopsis

struct              udev;
 struct udev *       udev_ref                            (struct udev *udev);
 void                udev_unref                          (struct udev *udev);
 struct udev *       udev_new                            (void);
 void                udev_set_log_fn                     (struct udev *udev,
-                                                         void (log_fnstruct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args) ());
+                                                         void (*log_fn) (struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args));
 int                 udev_get_log_priority               (struct udev *udev);
 void                udev_set_log_priority               (struct udev *udev,
                                                          int priority);
 const char *        udev_get_sys_path                   (struct udev *udev);
 const char *        udev_get_dev_path                   (struct udev *udev);
+const char *        udev_get_run_path                   (struct udev *udev);
 void *              udev_get_userdata                   (struct udev *udev);
 void                udev_set_userdata                   (struct udev *udev,
                                                          void *userdata);
 
-
+

Description

The context contains the default values read from the udev config file, and is passed to all library operations.

-
+

Details

-
+

struct udev

struct udev;

@@ -70,7 +71,7 @@ Opaque object representing the library context.


-
+

udev_ref ()

struct udev *       udev_ref                            (struct udev *udev);

@@ -81,19 +82,17 @@ Take a reference of the udev library context.

udev :

-udev library context - +udev library context

Returns :

- the passed udev library context - +the passed udev library context

-
+

udev_unref ()

void                udev_unref                          (struct udev *udev);

@@ -104,13 +103,12 @@ reaches zero, the resources of the context will be released.

udev :

-udev library context - +udev library context

-
+

udev_new ()

struct udev *       udev_new                            (void);

@@ -125,16 +123,15 @@ release the resources of the udev library context.

Returns :

- a new udev library context - +a new udev library context

-
+

udev_set_log_fn ()

void                udev_set_log_fn                     (struct udev *udev,
-                                                         void (log_fnstruct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args) ());
+ void (*log_fn) (struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args));

The built-in logging writes to stderr. It can be overridden by a custom function, to plug log messages @@ -142,15 +139,20 @@ into the users' logging functionality.

- + + - - + + + + + + +

udev :

udev library context -
udev library context

log_fn :

function to be called for logging messages

-
+

udev_get_log_priority ()

int                 udev_get_log_priority               (struct udev *udev);

@@ -162,19 +164,17 @@ at startup.

udev :

-udev library context - +udev library context

Returns :

- the current logging priority - +the current logging priority

-
+

udev_set_log_priority ()

void                udev_set_log_priority               (struct udev *udev,
                                                          int priority);
@@ -187,19 +187,17 @@ are logged.

udev :

-udev library context - +udev library context

priority :

-the new logging priority - +the new logging priority

-
+

udev_get_sys_path ()

const char *        udev_get_sys_path                   (struct udev *udev);

@@ -212,19 +210,17 @@ variable SYSFS_PATH.

udev :

-udev library context - +udev library context

Returns :

- the sys mount point - +the sys mount point

-
+

udev_get_dev_path ()

const char *        udev_get_dev_path                   (struct udev *udev);

@@ -237,19 +233,38 @@ file.

udev :

-udev library context - +udev library context

Returns :

- the device directory path - +the device directory path + + +
+
+
+
+

udev_get_run_path ()

+
const char *        udev_get_run_path                   (struct udev *udev);
+

+Retrieve the udev runtime directory path. The default is "/run/udev". +

+
++ + + + + + + +

udev :

udev library context

Returns :

the runtime directory path

-
+

udev_get_userdata ()

void *              udev_get_userdata                   (struct udev *udev);

@@ -261,19 +276,17 @@ to access from callbacks like a custom logging function.

udev :

-udev library context - +udev library context

Returns :

- stored userdata - +stored userdata

-
+

udev_set_userdata ()

void                udev_set_userdata                   (struct udev *udev,
                                                          void *userdata);
@@ -285,13 +298,11 @@ Store custom userdata in the library con

udev :

-udev library context - +udev library context

userdata :

-data pointer - +data pointer
@@ -300,6 +311,6 @@ Store custom userdata in the library con
+ Generated by GTK-Doc V1.18
\ No newline at end of file diff --git a/libudev/docs/html/libudev.devhelp b/libudev/docs/html/libudev.devhelp deleted file mode 100644 index b24330d..0000000 --- a/libudev/docs/html/libudev.devhelp +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libudev/docs/html/libudev.devhelp2 b/libudev/docs/html/libudev.devhelp2 index d5564ec..0b2ee86 100644 --- a/libudev/docs/html/libudev.devhelp2 +++ b/libudev/docs/html/libudev.devhelp2 @@ -9,6 +9,7 @@ + @@ -22,6 +23,7 @@ + @@ -56,8 +58,10 @@ + + @@ -83,6 +87,7 @@ + @@ -99,8 +104,8 @@ - + diff --git a/libudev/docs/html/style.css b/libudev/docs/html/style.css index d544a2c..d6f6c26 100644 --- a/libudev/docs/html/style.css +++ b/libudev/docs/html/style.css @@ -32,8 +32,9 @@ /* this is needed so that the local anchors are displayed below the naviagtion */ div.footnote a[name], div.refnamediv a[name], div.refsect1 a[name], div.refsect2 a[name], div.index a[name], div.glossary a[name], div.sect1 a[name] { + display: inline-block; position: relative; - padding-top:4.5em; + top:-5em; } /* this seems to be a bug in the xsl style sheets when generating indexes */ div.index div.index diff --git a/libudev/docs/libudev-docs.xml b/libudev/docs/libudev-docs.xml index f470916..b7feb45 100644 --- a/libudev/docs/libudev-docs.xml +++ b/libudev/docs/libudev-docs.xml @@ -9,7 +9,7 @@ libudev Reference Manual for libudev version &version; - 2009-2010 + 2009-2011 Kay Sievers <kay.sievers@vrfy.org> @@ -22,6 +22,7 @@ + diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt index 7db9c1b..15c3e93 100644 --- a/libudev/docs/libudev-sections.txt +++ b/libudev/docs/libudev-sections.txt @@ -10,6 +10,7 @@ udev_get_log_priority udev_set_log_priority udev_get_sys_path udev_get_dev_path +udev_get_run_path udev_get_userdata udev_set_userdata @@ -54,8 +55,10 @@ udev_device_get_driver udev_device_get_devnum udev_device_get_action udev_device_get_sysattr_value +udev_device_get_sysattr_list_entry udev_device_get_seqnum udev_device_get_usec_since_initialized +udev_device_has_tag
@@ -91,6 +94,7 @@ udev_enumerate_add_match_sysattr udev_enumerate_add_nomatch_sysattr udev_enumerate_add_match_property udev_enumerate_add_match_tag +udev_enumerate_add_match_parent udev_enumerate_add_match_is_initialized udev_enumerate_add_match_sysname udev_enumerate_add_syspath @@ -112,8 +116,12 @@ udev_queue_get_queue_is_empty udev_queue_get_seqnum_is_finished udev_queue_get_seqnum_sequence_is_finished udev_queue_get_queued_list_entry -udev_queue_get_failed_list_entry udev_queue_get_kernel_seqnum udev_queue_get_udev_seqnum
+
+libudev-util +udev_util +udev_util_encode_string +
diff --git a/libudev/docs/tmpl/libudev-device.sgml b/libudev/docs/tmpl/libudev-device.sgml index c3b94ab..7257cf6 100644 --- a/libudev/docs/tmpl/libudev-device.sgml +++ b/libudev/docs/tmpl/libudev-device.sgml @@ -261,6 +261,15 @@ udev_device @Returns: + + + + + +@udev_device: +@Returns: + + @@ -279,3 +288,13 @@ udev_device @Returns: + + + + + +@udev_device: +@tag: +@Returns: + + diff --git a/libudev/docs/tmpl/libudev-enumerate.sgml b/libudev/docs/tmpl/libudev-enumerate.sgml index e6f5f6f..912b10f 100644 --- a/libudev/docs/tmpl/libudev-enumerate.sgml +++ b/libudev/docs/tmpl/libudev-enumerate.sgml @@ -126,6 +126,16 @@ udev_enumerate @Returns: + + + + + +@udev_enumerate: +@parent: +@Returns: + + diff --git a/libudev/docs/tmpl/libudev-queue.sgml b/libudev/docs/tmpl/libudev-queue.sgml index 30dd4be..a0b3562 100644 --- a/libudev/docs/tmpl/libudev-queue.sgml +++ b/libudev/docs/tmpl/libudev-queue.sgml @@ -111,15 +111,6 @@ udev_queue @Returns: - - - - - -@udev_queue: -@Returns: - - diff --git a/libudev/docs/tmpl/libudev-util.sgml b/libudev/docs/tmpl/libudev-util.sgml new file mode 100644 index 0000000..cb30160 --- /dev/null +++ b/libudev/docs/tmpl/libudev-util.sgml @@ -0,0 +1,35 @@ + +udev_util + + + + + + + + + + + + + + + + + + + + + + + + + + + +@str: +@str_enc: +@len: +@Returns: + + diff --git a/libudev/docs/tmpl/libudev.sgml b/libudev/docs/tmpl/libudev.sgml index 8825cd2..b9de5ad 100644 --- a/libudev/docs/tmpl/libudev.sgml +++ b/libudev/docs/tmpl/libudev.sgml @@ -60,7 +60,7 @@ udev @udev: -@struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args: +@log_fn: @@ -99,6 +99,15 @@ udev @Returns: + + + + + +@udev: +@Returns: + + diff --git a/libudev/docs/version.xml b/libudev/docs/version.xml index cdffbbc..c5356ba 100644 --- a/libudev/docs/version.xml +++ b/libudev/docs/version.xml @@ -1 +1 @@ -166 +174 diff --git a/libudev/exported_symbols b/libudev/exported_symbols deleted file mode 100644 index 2e6a9b7..0000000 --- a/libudev/exported_symbols +++ /dev/null @@ -1,82 +0,0 @@ -udev_new -udev_ref -udev_unref -udev_set_log_fn -udev_get_log_priority -udev_set_log_priority -udev_get_userdata -udev_set_userdata -udev_get_sys_path -udev_get_dev_path -udev_list_entry_get_next -udev_list_entry_get_by_name -udev_list_entry_get_name -udev_list_entry_get_value -udev_device_new_from_syspath -udev_device_new_from_devnum -udev_device_new_from_subsystem_sysname -udev_device_new_from_environment -udev_device_get_parent -udev_device_get_parent_with_subsystem_devtype -udev_device_ref -udev_device_unref -udev_device_get_udev -udev_device_get_syspath -udev_device_get_devpath -udev_device_get_devnode -udev_device_get_sysname -udev_device_get_sysnum -udev_device_get_subsystem -udev_device_get_devtype -udev_device_get_is_initialized -udev_device_get_devlinks_list_entry -udev_device_get_properties_list_entry -udev_device_get_tags_list_entry -udev_device_get_property_value -udev_device_get_action -udev_device_get_driver -udev_device_get_devnum -udev_device_get_seqnum -udev_device_get_usec_since_initialized -udev_device_get_sysattr_value -udev_enumerate_new -udev_enumerate_ref -udev_enumerate_unref -udev_enumerate_get_udev -udev_enumerate_get_list_entry -udev_enumerate_add_match_subsystem -udev_enumerate_add_nomatch_subsystem -udev_enumerate_add_match_sysattr -udev_enumerate_add_nomatch_sysattr -udev_enumerate_add_match_property -udev_enumerate_add_match_tag -udev_enumerate_add_match_is_initialized -udev_enumerate_add_match_sysname -udev_enumerate_scan_devices -udev_enumerate_scan_subsystems -udev_enumerate_add_syspath -udev_monitor_new_from_socket -udev_monitor_new_from_netlink -udev_monitor_set_receive_buffer_size -udev_monitor_enable_receiving -udev_monitor_ref -udev_monitor_unref -udev_monitor_get_udev -udev_monitor_get_fd -udev_monitor_receive_device -udev_monitor_filter_add_match_subsystem_devtype -udev_monitor_filter_add_match_tag -udev_monitor_filter_update -udev_monitor_filter_remove -udev_queue_new -udev_queue_ref -udev_queue_unref -udev_queue_get_udev -udev_queue_get_kernel_seqnum -udev_queue_get_udev_seqnum -udev_queue_get_udev_is_active -udev_queue_get_queue_is_empty -udev_queue_get_seqnum_is_finished -udev_queue_get_seqnum_sequence_is_finished -udev_queue_get_queued_list_entry -udev_queue_get_failed_list_entry diff --git a/libudev/libudev-ctrl.c b/libudev/libudev-ctrl.c deleted file mode 100644 index af59c36..0000000 --- a/libudev/libudev-ctrl.c +++ /dev/null @@ -1,320 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -/* wire protocol magic must match */ -#define UDEV_CTRL_MAGIC 0xdead1dea - -enum udev_ctrl_msg_type { - UDEV_CTRL_UNKNOWN, - UDEV_CTRL_SET_LOG_LEVEL, - UDEV_CTRL_STOP_EXEC_QUEUE, - UDEV_CTRL_START_EXEC_QUEUE, - UDEV_CTRL_RELOAD_RULES, - UDEV_CTRL_SET_ENV, - UDEV_CTRL_SET_CHILDREN_MAX, - UDEV_CTRL_SETTLE, -}; - -struct udev_ctrl_msg_wire { - char version[16]; - unsigned int magic; - enum udev_ctrl_msg_type type; - union { - int intval; - char buf[256]; - }; -}; - -struct udev_ctrl_msg { - int refcount; - struct udev_ctrl *uctrl; - struct udev_ctrl_msg_wire ctrl_msg_wire; - pid_t pid; -}; - -struct udev_ctrl { - int refcount; - struct udev *udev; - int sock; - struct sockaddr_un saddr; - socklen_t addrlen; -}; - -struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path) -{ - struct udev_ctrl *uctrl; - - uctrl = calloc(1, sizeof(struct udev_ctrl)); - if (uctrl == NULL) - return NULL; - uctrl->refcount = 1; - uctrl->udev = udev; - - uctrl->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (uctrl->sock < 0) { - err(udev, "error getting socket: %m\n"); - udev_ctrl_unref(uctrl); - return NULL; - } - - uctrl->saddr.sun_family = AF_LOCAL; - strcpy(uctrl->saddr.sun_path, socket_path); - uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); - /* translate leading '@' to abstract namespace */ - if (uctrl->saddr.sun_path[0] == '@') - uctrl->saddr.sun_path[0] = '\0'; - - return uctrl; -} - -int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) -{ - int err; - const int feature_on = 1; - - err= bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); - if (err < 0) { - err(uctrl->udev, "bind failed: %m\n"); - return err; - } - - /* enable receiving of the sender credentials */ - setsockopt(uctrl->sock, SOL_SOCKET, SO_PASSCRED, &feature_on, sizeof(feature_on)); - return 0; -} - -struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl) -{ - return uctrl->udev; -} - -struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl) -{ - if (uctrl == NULL) - return NULL; - uctrl->refcount++; - return uctrl; -} - -void udev_ctrl_unref(struct udev_ctrl *uctrl) -{ - if (uctrl == NULL) - return; - uctrl->refcount--; - if (uctrl->refcount > 0) - return; - if (uctrl->sock >= 0) - close(uctrl->sock); - free(uctrl); -} - -int udev_ctrl_get_fd(struct udev_ctrl *uctrl) -{ - if (uctrl == NULL) - return -1; - return uctrl->sock; -} - -static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf) -{ - struct udev_ctrl_msg_wire ctrl_msg_wire; - int err; - - memset(&ctrl_msg_wire, 0x00, sizeof(struct udev_ctrl_msg_wire)); - strcpy(ctrl_msg_wire.version, "udev-" VERSION); - ctrl_msg_wire.magic = UDEV_CTRL_MAGIC; - ctrl_msg_wire.type = type; - - if (buf != NULL) - util_strscpy(ctrl_msg_wire.buf, sizeof(ctrl_msg_wire.buf), buf); - else - ctrl_msg_wire.intval = intval; - - err = sendto(uctrl->sock, &ctrl_msg_wire, sizeof(ctrl_msg_wire), 0, - (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); - if (err == -1) { - err(uctrl->udev, "error sending message: %m\n"); - } - return err; -} - -int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority) -{ - return ctrl_send(uctrl, UDEV_CTRL_SET_LOG_LEVEL, priority, NULL); -} - -int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl) -{ - return ctrl_send(uctrl, UDEV_CTRL_STOP_EXEC_QUEUE, 0, NULL); -} - -int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl) -{ - return ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL); -} - -int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl) -{ - return ctrl_send(uctrl, UDEV_CTRL_RELOAD_RULES, 0, NULL); -} - -int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key) -{ - return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key); -} - -int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count) -{ - return ctrl_send(uctrl, UDEV_CTRL_SET_CHILDREN_MAX, count, NULL); -} - -int udev_ctrl_send_settle(struct udev_ctrl *uctrl) -{ - return ctrl_send(uctrl, UDEV_CTRL_SETTLE, 0, NULL); -} - -struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl) -{ - struct udev_ctrl_msg *uctrl_msg; - ssize_t size; - struct msghdr smsg; - struct cmsghdr *cmsg; - struct iovec iov; - struct ucred *cred; - char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; - - uctrl_msg = calloc(1, sizeof(struct udev_ctrl_msg)); - if (uctrl_msg == NULL) - return NULL; - uctrl_msg->refcount = 1; - uctrl_msg->uctrl = uctrl; - - iov.iov_base = &uctrl_msg->ctrl_msg_wire; - iov.iov_len = sizeof(struct udev_ctrl_msg_wire); - - memset(&smsg, 0x00, sizeof(struct msghdr)); - smsg.msg_iov = &iov; - smsg.msg_iovlen = 1; - smsg.msg_control = cred_msg; - smsg.msg_controllen = sizeof(cred_msg); - - size = recvmsg(uctrl->sock, &smsg, 0); - if (size < 0) { - err(uctrl->udev, "unable to receive user udevd message: %m\n"); - goto err; - } - cmsg = CMSG_FIRSTHDR(&smsg); - cred = (struct ucred *) CMSG_DATA(cmsg); - - if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - err(uctrl->udev, "no sender credentials received, message ignored\n"); - goto err; - } - - if (cred->uid != 0) { - err(uctrl->udev, "sender uid=%i, message ignored\n", cred->uid); - goto err; - } - - uctrl_msg->pid = cred->pid; - - if (uctrl_msg->ctrl_msg_wire.magic != UDEV_CTRL_MAGIC) { - err(uctrl->udev, "message magic 0x%08x doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic); - goto err; - } - - dbg(uctrl->udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); - return uctrl_msg; -err: - udev_ctrl_msg_unref(uctrl_msg); - return NULL; -} - -struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg == NULL) - return NULL; - ctrl_msg->refcount++; - return ctrl_msg; -} - -void udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg == NULL) - return; - ctrl_msg->refcount--; - if (ctrl_msg->refcount > 0) - return; - dbg(ctrl_msg->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg); - free(ctrl_msg); -} - -int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_LOG_LEVEL) - return ctrl_msg->ctrl_msg_wire.intval; - return -1; -} - -int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_STOP_EXEC_QUEUE) - return 1; - return -1; -} - -int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_START_EXEC_QUEUE) - return 1; - return -1; -} - -int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_RELOAD_RULES) - return 1; - return -1; -} - -const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_ENV) - return ctrl_msg->ctrl_msg_wire.buf; - return NULL; -} - -int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_CHILDREN_MAX) - return ctrl_msg->ctrl_msg_wire.intval; - return -1; -} - -pid_t udev_ctrl_get_settle(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SETTLE) - return ctrl_msg->pid; - return -1; -} diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 3afa82e..b78b6c9 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -31,7 +31,7 @@ static void udev_device_tag(struct udev_device *dev, const char *tag, bool add) id = udev_device_get_id_filename(dev); if (id == NULL) return; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/tags/", tag, "/", id, NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/tags/", tag, "/", id, NULL); if (add) { int fd; @@ -86,7 +86,7 @@ static bool device_has_info(struct udev_device *udev_device) if (udev_device_get_devlink_priority(udev_device) != 0) return true; udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) - if (udev_list_entry_get_flags(list_entry)) + if (udev_list_entry_get_num(list_entry)) return true; if (udev_device_get_tags_list_entry(udev_device) != NULL) return true; @@ -115,7 +115,7 @@ int udev_device_update_db(struct udev_device *udev_device) return -1; has_info = device_has_info(udev_device); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", id, NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data/", id, NULL); /* do not store anything for otherwise empty devices */ if (!has_info && @@ -134,6 +134,13 @@ int udev_device_update_db(struct udev_device *udev_device) return -1; } + /* + * set 'sticky' bit to indicate that we should not clean the + * database when we transition from initramfs to the real root + */ + if (udev_device_get_db_persist(udev_device)) + fchmod(fileno(f), 01644); + if (has_info) { size_t devlen = strlen(udev_get_dev_path(udev))+1; struct udev_list_entry *list_entry; @@ -150,7 +157,7 @@ int udev_device_update_db(struct udev_device *udev_device) if (udev_device_get_usec_initialized(udev_device) > 0) fprintf(f, "I:%llu\n", udev_device_get_usec_initialized(udev_device)); udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { - if (!udev_list_entry_get_flags(list_entry)) + if (!udev_list_entry_get_num(list_entry)) continue; fprintf(f, "E:%s=%s\n", udev_list_entry_get_name(list_entry), @@ -176,7 +183,7 @@ int udev_device_delete_db(struct udev_device *udev_device) id = udev_device_get_id_filename(udev_device); if (id == NULL) return -1; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", id, NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data/", id, NULL); unlink(filename); return 0; } diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 16bee19..1024b46 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -19,7 +19,11 @@ #include #include #include +#include #include +#include +#include +#include #include "libudev.h" #include "libudev-private.h" @@ -47,24 +51,24 @@ struct udev_device { char *sysname; const char *sysnum; char *devnode; + mode_t devnode_mode; char *subsystem; char *devtype; char *driver; char *action; char *devpath_old; - char *sysname_old; char *knodename; char *id_filename; char **envp; char *monitor_buf; size_t monitor_buf_len; - struct udev_list_node devlinks_list; - struct udev_list_node properties_list; - struct udev_list_node sysattr_list; - struct udev_list_node tags_list; + struct udev_list devlinks_list; + struct udev_list properties_list; + struct udev_list sysattr_value_list; + struct udev_list sysattr_list; + struct udev_list tags_list; unsigned long long int seqnum; unsigned long long int usec_initialized; - int event_timeout; int timeout; int devlink_priority; int refcount; @@ -83,8 +87,264 @@ struct udev_device { bool db_loaded; bool uevent_loaded; bool is_initialized; + bool sysattr_list_read; + bool db_persist; }; +/** + * udev_device_get_seqnum: + * @udev_device: udev device + * + * This is only valid if the device was received through a monitor. Devices read from + * sys do not have a sequence number. + * + * Returns: the kernel event sequence number, or 0 if there is no sequence number available. + **/ +UDEV_EXPORT unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return 0; + return udev_device->seqnum; +} + +static int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum) +{ + char num[32]; + + udev_device->seqnum = seqnum; + snprintf(num, sizeof(num), "%llu", seqnum); + udev_device_add_property(udev_device, "SEQNUM", num); + return 0; +} + +int udev_device_get_ifindex(struct udev_device *udev_device) +{ + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); + return udev_device->ifindex; +} + +static int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex) +{ + char num[32]; + + udev_device->ifindex = ifindex; + snprintf(num, sizeof(num), "%u", ifindex); + udev_device_add_property(udev_device, "IFINDEX", num); + return 0; +} + +/** + * udev_device_get_devnum: + * @udev_device: udev device + * + * Returns: the device major/minor number. + **/ +UDEV_EXPORT dev_t udev_device_get_devnum(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return makedev(0, 0); + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); + return udev_device->devnum; +} + +static int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) +{ + char num[32]; + + udev_device->devnum = devnum; + + snprintf(num, sizeof(num), "%u", major(devnum)); + udev_device_add_property(udev_device, "MAJOR", num); + snprintf(num, sizeof(num), "%u", minor(devnum)); + udev_device_add_property(udev_device, "MINOR", num); + return 0; +} + +int udev_device_get_timeout(struct udev_device *udev_device) +{ + return udev_device->timeout; +} + +static int udev_device_set_timeout(struct udev_device *udev_device, int timeout) +{ + char num[32]; + + udev_device->timeout = timeout; + snprintf(num, sizeof(num), "%u", timeout); + udev_device_add_property(udev_device, "TIMEOUT", num); + return 0; +} + +const char *udev_device_get_knodename(struct udev_device *udev_device) +{ + return udev_device->knodename; +} + +static int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename) +{ + free(udev_device->knodename); + udev_device->knodename = strdup(knodename); + if (udev_device->knodename == NULL) + return -ENOMEM; + /* do not overwrite the udev property with the kernel property */ + if (udev_device->devnode == NULL) + udev_device_add_property(udev_device, "DEVNAME", udev_device->knodename); + return 0; +} + +const char *udev_device_get_devpath_old(struct udev_device *udev_device) +{ + return udev_device->devpath_old; +} + +static int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old) +{ + const char *pos; + + free(udev_device->devpath_old); + udev_device->devpath_old = strdup(devpath_old); + if (udev_device->devpath_old == NULL) + return -ENOMEM; + udev_device_add_property(udev_device, "DEVPATH_OLD", udev_device->devpath_old); + + pos = strrchr(udev_device->devpath_old, '/'); + if (pos == NULL) + return -EINVAL; + return 0; +} + +/** + * udev_device_get_driver: + * @udev_device: udev device + * + * Returns: the driver string, or #NULL if there is no driver attached. + **/ +UDEV_EXPORT const char *udev_device_get_driver(struct udev_device *udev_device) +{ + char driver[UTIL_NAME_SIZE]; + + if (udev_device == NULL) + return NULL; + if (!udev_device->driver_set) { + udev_device->driver_set = true; + if (util_get_sys_core_link_value(udev_device->udev, "driver", udev_device->syspath, driver, sizeof(driver)) > 0) + udev_device->driver = strdup(driver); + } + return udev_device->driver; +} + +static int udev_device_set_driver(struct udev_device *udev_device, const char *driver) +{ + free(udev_device->driver); + udev_device->driver = strdup(driver); + if (udev_device->driver == NULL) + return -ENOMEM; + udev_device->driver_set = true; + udev_device_add_property(udev_device, "DRIVER", udev_device->driver); + return 0; +} + +/** + * udev_device_get_devtype: + * @udev_device: udev device + * + * Retrieve the devtype string of the udev device. + * + * Returns: the devtype name of the udev device, or #NULL if it can not be determined + **/ +UDEV_EXPORT const char *udev_device_get_devtype(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + if (!udev_device->devtype_set) { + udev_device->devtype_set = true; + udev_device_read_uevent_file(udev_device); + } + return udev_device->devtype; +} + +static int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype) +{ + free(udev_device->devtype); + udev_device->devtype = strdup(devtype); + if (udev_device->devtype == NULL) + return -ENOMEM; + udev_device->devtype_set = true; + udev_device_add_property(udev_device, "DEVTYPE", udev_device->devtype); + return 0; +} + +static int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem) +{ + free(udev_device->subsystem); + udev_device->subsystem = strdup(subsystem); + if (udev_device->subsystem == NULL) + return -ENOMEM; + udev_device->subsystem_set = true; + udev_device_add_property(udev_device, "SUBSYSTEM", udev_device->subsystem); + return 0; +} + +/** + * udev_device_get_subsystem: + * @udev_device: udev device + * + * Retrieve the subsystem string of the udev device. The string does not + * contain any "/". + * + * Returns: the subsystem name of the udev device, or #NULL if it can not be determined + **/ +UDEV_EXPORT const char *udev_device_get_subsystem(struct udev_device *udev_device) +{ + char subsystem[UTIL_NAME_SIZE]; + + if (udev_device == NULL) + return NULL; + if (!udev_device->subsystem_set) { + udev_device->subsystem_set = true; + /* read "subsystem" link */ + if (util_get_sys_core_link_value(udev_device->udev, "subsystem", udev_device->syspath, subsystem, sizeof(subsystem)) > 0) { + udev_device_set_subsystem(udev_device, subsystem); + return udev_device->subsystem; + } + /* implicit names */ + if (strncmp(udev_device->devpath, "/module/", 8) == 0) { + udev_device_set_subsystem(udev_device, "module"); + return udev_device->subsystem; + } + if (strstr(udev_device->devpath, "/drivers/") != NULL) { + udev_device_set_subsystem(udev_device, "drivers"); + return udev_device->subsystem; + } + if (strncmp(udev_device->devpath, "/subsystem/", 11) == 0 || + strncmp(udev_device->devpath, "/class/", 7) == 0 || + strncmp(udev_device->devpath, "/bus/", 5) == 0) { + udev_device_set_subsystem(udev_device, "subsystem"); + return udev_device->subsystem; + } + } + return udev_device->subsystem; +} + +mode_t udev_device_get_devnode_mode(struct udev_device *udev_device) +{ + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); + return udev_device->devnode_mode; +} + +static int udev_device_set_devnode_mode(struct udev_device *udev_device, mode_t mode) +{ + char num[32]; + + udev_device->devnode_mode = mode; + snprintf(num, sizeof(num), "%#o", mode); + udev_device_add_property(udev_device, "DEVMODE", num); + return 0; +} + struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) { udev_device->envp_uptodate = false; @@ -97,7 +357,7 @@ struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device udev_list_entry_delete(list_entry); return NULL; } - return udev_list_entry_add(udev_device->udev, &udev_device->properties_list, key, value, 1, 0); + return udev_list_entry_add(&udev_device->properties_list, key, value); } static struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property) @@ -177,6 +437,8 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device, udev_device_add_tag(udev_device, tag); } } + } else if (strncmp(property, "USEC_INITIALIZED=", 19) == 0) { + udev_device_set_usec_initialized(udev_device, strtoull(&property[19], NULL, 10)); } else if (strncmp(property, "DRIVER=", 7) == 0) { udev_device_set_driver(udev_device, &property[7]); } else if (strncmp(property, "ACTION=", 7) == 0) { @@ -193,6 +455,8 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device, udev_device_set_timeout(udev_device, strtoull(&property[8], NULL, 10)); } else if (strncmp(property, "IFINDEX=", 8) == 0) { udev_device_set_ifindex(udev_device, strtoull(&property[8], NULL, 10)); + } else if (strncmp(property, "DEVMODE=", 8) == 0) { + udev_device_set_devnode_mode(udev_device, strtoul(&property[8], NULL, 8)); } else { udev_device_add_property_from_string(udev_device, property); } @@ -217,7 +481,7 @@ int udev_device_add_property_from_string_parse_finish(struct udev_device *udev_d * * Returns: the value of a device property, or #NULL if there is no such property. **/ -const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key) +UDEV_EXPORT const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key) { struct udev_list_entry *list_entry; @@ -227,28 +491,34 @@ const char *udev_device_get_property_value(struct udev_device *udev_device, cons return NULL; list_entry = udev_device_get_properties_list_entry(udev_device); - list_entry = udev_list_entry_get_by_name(list_entry, key); + list_entry = udev_list_entry_get_by_name(list_entry, key); return udev_list_entry_get_value(list_entry); } -int udev_device_read_db(struct udev_device *udev_device) +int udev_device_read_db(struct udev_device *udev_device, const char *dbfile) { - const char *id; char filename[UTIL_PATH_SIZE]; char line[UTIL_LINE_SIZE]; FILE *f; - if (udev_device->db_loaded) - return 0; - udev_device->db_loaded = true; + /* providing a database file will always force-load it */ + if (dbfile == NULL) { + const char *id; - id = udev_device_get_id_filename(udev_device); - if (id == NULL) - return -1; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/.udev/db/", id, NULL); - f = fopen(filename, "re"); + if (udev_device->db_loaded) + return 0; + udev_device->db_loaded = true; + + id = udev_device_get_id_filename(udev_device); + if (id == NULL) + return -1; + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_device->udev), "/data/", id, NULL); + dbfile = filename; + } + + f = fopen(dbfile, "re"); if (f == NULL) { - info(udev_device->udev, "no db file to read %s: %m\n", filename); + info(udev_device->udev, "no db file to read %s: %m\n", dbfile); return -1; } udev_device->is_initialized = true; @@ -277,7 +547,7 @@ int udev_device_read_db(struct udev_device *udev_device) break; case 'E': entry = udev_device_add_property_from_string(udev_device, val); - udev_list_entry_set_flags(entry, 1); + udev_list_entry_set_num(entry, true); break; case 'G': udev_device_add_tag(udev_device, val); @@ -331,6 +601,8 @@ int udev_device_read_uevent_file(struct udev_device *udev_device) udev_device_set_ifindex(udev_device, strtoull(&line[8], NULL, 10)); else if (strncmp(line, "DEVNAME=", 8) == 0) udev_device_set_knodename(udev_device, &line[8]); + else if (strncmp(line, "DEVMODE=", 8) == 0) + udev_device->devnode_mode = strtoul(&line[8], NULL, 8); udev_device_add_property_from_string(udev_device, line); } @@ -358,11 +630,12 @@ struct udev_device *udev_device_new(struct udev *udev) return NULL; udev_device->refcount = 1; udev_device->udev = udev; - udev_list_init(&udev_device->devlinks_list); - udev_list_init(&udev_device->properties_list); - udev_list_init(&udev_device->sysattr_list); - udev_list_init(&udev_device->tags_list); - udev_device->event_timeout = -1; + udev_list_init(udev, &udev_device->devlinks_list, true); + udev_list_init(udev, &udev_device->properties_list, true); + udev_list_init(udev, &udev_device->sysattr_value_list, true); + udev_list_init(udev, &udev_device->sysattr_list, false); + udev_list_init(udev, &udev_device->tags_list, true); + udev_device->timeout = -1; udev_device->watch_handle = -1; /* copy global properties */ udev_list_entry_foreach(list_entry, udev_get_properties_list_entry(udev)) @@ -387,7 +660,7 @@ struct udev_device *udev_device_new(struct udev *udev) * * Returns: a new udev device, or #NULL, if it does not exist **/ -struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath) +UDEV_EXPORT struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath) { size_t len; const char *subdir; @@ -463,7 +736,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * * * Returns: a new udev device, or #NULL, if it does not exist **/ -struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum) +UDEV_EXPORT struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum) { char path[UTIL_PATH_SIZE]; const char *type_str; @@ -494,6 +767,35 @@ struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id if (sscanf(id, "%c%i:%i", &type, &maj, &min) != 3) return NULL; return udev_device_new_from_devnum(udev, type, makedev(maj, min)); + case 'n': { + int sk; + struct ifreq ifr; + struct udev_device *dev; + int ifindex; + + ifindex = strtoul(&id[1], NULL, 10); + if (ifindex <= 0) + return NULL; + + sk = socket(PF_INET, SOCK_DGRAM, 0); + if (sk < 0) + return NULL; + memset(&ifr, 0x00, sizeof(struct ifreq)); + ifr.ifr_ifindex = ifindex; + if (ioctl(sk, SIOCGIFNAME, &ifr) != 0) { + close(sk); + return NULL; + } + close(sk); + + dev = udev_device_new_from_subsystem_sysname(udev, "net", ifr.ifr_name); + if (dev == NULL) + return NULL; + if (udev_device_get_ifindex(dev) == ifindex) + return dev; + udev_device_unref(dev); + return NULL; + } case '+': util_strscpy(subsys, sizeof(subsys), &id[1]); sysname = strchr(subsys, ':'); @@ -522,7 +824,7 @@ struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id * * Returns: a new udev device, or #NULL, if it does not exist **/ -struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname) +UDEV_EXPORT struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname) { char path_full[UTIL_PATH_SIZE]; char *path; @@ -606,7 +908,7 @@ found: * * Returns: a new udev device, or #NULL, if it does not exist **/ -struct udev_device *udev_device_new_from_environment(struct udev *udev) +UDEV_EXPORT struct udev_device *udev_device_new_from_environment(struct udev *udev) { int i; struct udev_device *udev_device; @@ -669,7 +971,7 @@ static struct udev_device *device_new_from_parent(struct udev_device *udev_devic * * Returns: a new udev device, or #NULL, if it no parent exist. **/ -struct udev_device *udev_device_get_parent(struct udev_device *udev_device) +UDEV_EXPORT struct udev_device *udev_device_get_parent(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -704,7 +1006,7 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device) * * Returns: a new udev device, or #NULL if no matching parent exists. **/ -struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype) +UDEV_EXPORT struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype) { struct udev_device *parent; @@ -737,7 +1039,7 @@ struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_de * * Returns: the udev library context **/ -struct udev *udev_device_get_udev(struct udev_device *udev_device) +UDEV_EXPORT struct udev *udev_device_get_udev(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -752,7 +1054,7 @@ struct udev *udev_device_get_udev(struct udev_device *udev_device) * * Returns: the passed udev device **/ -struct udev_device *udev_device_ref(struct udev_device *udev_device) +UDEV_EXPORT struct udev_device *udev_device_ref(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -768,7 +1070,7 @@ struct udev_device *udev_device_ref(struct udev_device *udev_device) * the resources of the device will be released. * **/ -void udev_device_unref(struct udev_device *udev_device) +UDEV_EXPORT void udev_device_unref(struct udev_device *udev_device) { if (udev_device == NULL) return; @@ -782,14 +1084,14 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->devnode); free(udev_device->subsystem); free(udev_device->devtype); - udev_list_cleanup_entries(udev_device->udev, &udev_device->devlinks_list); - udev_list_cleanup_entries(udev_device->udev, &udev_device->properties_list); - udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_list); - udev_list_cleanup_entries(udev_device->udev, &udev_device->tags_list); + udev_list_cleanup(&udev_device->devlinks_list); + udev_list_cleanup(&udev_device->properties_list); + udev_list_cleanup(&udev_device->sysattr_value_list); + udev_list_cleanup(&udev_device->sysattr_list); + udev_list_cleanup(&udev_device->tags_list); free(udev_device->action); free(udev_device->driver); free(udev_device->devpath_old); - free(udev_device->sysname_old); free(udev_device->knodename); free(udev_device->id_filename); free(udev_device->envp); @@ -807,7 +1109,7 @@ void udev_device_unref(struct udev_device *udev_device) * * Returns: the devpath of the udev device **/ -const char *udev_device_get_devpath(struct udev_device *udev_device) +UDEV_EXPORT const char *udev_device_get_devpath(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -823,7 +1125,7 @@ const char *udev_device_get_devpath(struct udev_device *udev_device) * * Returns: the sys path of the udev device **/ -const char *udev_device_get_syspath(struct udev_device *udev_device) +UDEV_EXPORT const char *udev_device_get_syspath(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -836,7 +1138,7 @@ const char *udev_device_get_syspath(struct udev_device *udev_device) * * Returns: the sys name of the device device **/ -const char *udev_device_get_sysname(struct udev_device *udev_device) +UDEV_EXPORT const char *udev_device_get_sysname(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -849,7 +1151,7 @@ const char *udev_device_get_sysname(struct udev_device *udev_device) * * Returns: the trailing number of of the device name **/ -const char *udev_device_get_sysnum(struct udev_device *udev_device) +UDEV_EXPORT const char *udev_device_get_sysnum(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -865,13 +1167,13 @@ const char *udev_device_get_sysnum(struct udev_device *udev_device) * * Returns: the device node file name of the udev device, or #NULL if no device node exists **/ -const char *udev_device_get_devnode(struct udev_device *udev_device) +UDEV_EXPORT const char *udev_device_get_devnode(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; if (!udev_device->info_loaded) { udev_device_read_uevent_file(udev_device); - udev_device_read_db(udev_device); + udev_device_read_db(udev_device, NULL); } /* we might get called before we handled an event and have a db, use the kernel-provided name */ @@ -888,91 +1190,31 @@ const char *udev_device_get_devnode(struct udev_device *udev_device) } /** - * udev_device_get_subsystem: + * udev_device_get_devlinks_list_entry: * @udev_device: udev device * - * Retrieve the subsystem string of the udev device. The string does not - * contain any "/". - * - * Returns: the subsystem name of the udev device, or #NULL if it can not be determined - **/ -const char *udev_device_get_subsystem(struct udev_device *udev_device) -{ - char subsystem[UTIL_NAME_SIZE]; - - if (udev_device == NULL) - return NULL; - if (!udev_device->subsystem_set) { - udev_device->subsystem_set = true; - /* read "subsystem" link */ - if (util_get_sys_subsystem(udev_device->udev, udev_device->syspath, subsystem, sizeof(subsystem)) > 0) { - udev_device_set_subsystem(udev_device, subsystem); - return udev_device->subsystem; - } - /* implicit names */ - if (strncmp(udev_device->devpath, "/module/", 8) == 0) { - udev_device_set_subsystem(udev_device, "module"); - return udev_device->subsystem; - } - if (strstr(udev_device->devpath, "/drivers/") != NULL) { - udev_device_set_subsystem(udev_device, "drivers"); - return udev_device->subsystem; - } - if (strncmp(udev_device->devpath, "/subsystem/", 11) == 0 || - strncmp(udev_device->devpath, "/class/", 7) == 0 || - strncmp(udev_device->devpath, "/bus/", 5) == 0) { - udev_device_set_subsystem(udev_device, "subsystem"); - return udev_device->subsystem; - } - } - return udev_device->subsystem; -} - -/** - * udev_device_get_devtype: - * @udev_device: udev device - * - * Retrieve the devtype string of the udev device. - * - * Returns: the devtype name of the udev device, or #NULL if it can not be determined - **/ -const char *udev_device_get_devtype(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - if (!udev_device->devtype_set) { - udev_device->devtype_set = true; - udev_device_read_uevent_file(udev_device); - } - return udev_device->devtype; -} - -/** - * udev_device_get_devlinks_list_entry: - * @udev_device: udev device - * - * Retrieve the list of device links pointing to the device file of - * the udev device. The next list entry can be retrieved with - * udev_list_entry_next(), which returns #NULL if no more entries exist. - * The devlink path can be retrieved from the list entry by - * udev_list_entry_get_name(). The path is an absolute path, and starts with - * the device directory. + * Retrieve the list of device links pointing to the device file of + * the udev device. The next list entry can be retrieved with + * udev_list_entry_next(), which returns #NULL if no more entries exist. + * The devlink path can be retrieved from the list entry by + * udev_list_entry_get_name(). The path is an absolute path, and starts with + * the device directory. * * Returns: the first entry of the device node link list **/ -struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device) +UDEV_EXPORT struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; if (!udev_device->info_loaded) - udev_device_read_db(udev_device); + udev_device_read_db(udev_device, NULL); return udev_list_get_entry(&udev_device->devlinks_list); } void udev_device_cleanup_devlinks_list(struct udev_device *udev_device) { udev_device->devlinks_uptodate = false; - udev_list_cleanup_entries(udev_device->udev, &udev_device->devlinks_list); + udev_list_cleanup(&udev_device->devlinks_list); } /** @@ -987,13 +1229,13 @@ void udev_device_cleanup_devlinks_list(struct udev_device *udev_device) * * Returns: the first entry of the property list **/ -struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device) +UDEV_EXPORT struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; if (!udev_device->info_loaded) { udev_device_read_uevent_file(udev_device); - udev_device_read_db(udev_device); + udev_device_read_db(udev_device, NULL); } if (!udev_device->devlinks_uptodate) { char symlinks[UTIL_PATH_SIZE]; @@ -1031,41 +1273,6 @@ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device } /** - * udev_device_get_driver: - * @udev_device: udev device - * - * Returns: the driver string, or #NULL if there is no driver attached. - **/ -const char *udev_device_get_driver(struct udev_device *udev_device) -{ - char driver[UTIL_NAME_SIZE]; - - if (udev_device == NULL) - return NULL; - if (!udev_device->driver_set) { - udev_device->driver_set = true; - if (util_get_sys_driver(udev_device->udev, udev_device->syspath, driver, sizeof(driver)) > 0) - udev_device->driver = strdup(driver); - } - return udev_device->driver; -} - -/** - * udev_device_get_devnum: - * @udev_device: udev device - * - * Returns: the device major/minor number. - **/ -dev_t udev_device_get_devnum(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return makedev(0, 0); - if (!udev_device->info_loaded) - udev_device_read_uevent_file(udev_device); - return udev_device->devnum; -} - -/** * udev_device_get_action: * @udev_device: udev device * @@ -1075,7 +1282,7 @@ dev_t udev_device_get_devnum(struct udev_device *udev_device) * * Returns: the kernel action value, or #NULL if there is no action value available. **/ -const char *udev_device_get_action(struct udev_device *udev_device) +UDEV_EXPORT const char *udev_device_get_action(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -1083,22 +1290,6 @@ const char *udev_device_get_action(struct udev_device *udev_device) } /** - * udev_device_get_devnum: - * @udev_device: udev device - * - * This is only valid if the device was received through a monitor. Devices read from - * sys do not have a sequence number. - * - * Returns: the kernel event sequence number, or 0 if there is no sequence number available. - **/ -unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return 0; - return udev_device->seqnum; -} - -/** * udev_device_get_usec_since_initialized: * @udev_device: udev device * @@ -1110,17 +1301,17 @@ unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) * * Returns: the number of microseconds since the device was first seen. **/ -unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device) +UDEV_EXPORT unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device) { unsigned long long now; if (udev_device == NULL) return 0; if (!udev_device->info_loaded) - udev_device_read_db(udev_device); + udev_device_read_db(udev_device, NULL); if (udev_device->usec_initialized == 0) return 0; - now = usec_monotonic(); + now = now_usec(); if (now == 0) return 0; return now - udev_device->usec_initialized; @@ -1133,7 +1324,11 @@ unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_dev void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized) { + char num[32]; + udev_device->usec_initialized = usec_initialized; + snprintf(num, sizeof(num), "%llu", usec_initialized); + udev_device_add_property(udev_device, "USEC_INITIALIZED", num); } /** @@ -1146,7 +1341,7 @@ void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned * * Returns: the content of a sys attribute file, or #NULL if there is no sys attribute value. **/ -const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr) +UDEV_EXPORT const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr) { struct udev_list_entry *list_entry; char path[UTIL_PATH_SIZE]; @@ -1162,43 +1357,48 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const return NULL; /* look for possibly already cached result */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_device->sysattr_list)) { - if (strcmp(udev_list_entry_get_name(list_entry), sysattr) == 0) { - dbg(udev_device->udev, "got '%s' (%s) from cache\n", - sysattr, udev_list_entry_get_value(list_entry)); - return udev_list_entry_get_value(list_entry); - } + list_entry = udev_list_get_entry(&udev_device->sysattr_value_list); + list_entry = udev_list_entry_get_by_name(list_entry, sysattr); + if (list_entry != NULL) { + dbg(udev_device->udev, "got '%s' (%s) from cache\n", + sysattr, udev_list_entry_get_value(list_entry)); + return udev_list_entry_get_value(list_entry); } util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", sysattr, NULL); if (lstat(path, &statbuf) != 0) { dbg(udev_device->udev, "no attribute '%s', keep negative entry\n", path); - udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, NULL, 0, 0); + udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, NULL); goto out; } if (S_ISLNK(statbuf.st_mode)) { - char target[UTIL_NAME_SIZE]; - int len; - char *pos; - - /* some core links return the last element of the target path */ - if (strcmp(sysattr, "driver") != 0 && - strcmp(sysattr, "subsystem") != 0 && - strcmp(sysattr, "module") != 0) - goto out; - - len = readlink(path, target, sizeof(target)); - if (len <= 0 || len == sizeof(target)) + struct udev_device *dev; + + /* + * Some core links return only the last element of the target path, + * these are just values, the paths should not be exposed. + */ + if (strcmp(sysattr, "driver") == 0 || + strcmp(sysattr, "subsystem") == 0 || + strcmp(sysattr, "module") == 0) { + if (util_get_sys_core_link_value(udev_device->udev, sysattr, + udev_device->syspath, value, sizeof(value)) < 0) + return NULL; + dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, value); + list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, value); + val = udev_list_entry_get_value(list_entry); goto out; - target[len] = '\0'; + } - pos = strrchr(target, '/'); - if (pos != NULL) { - pos = &pos[1]; - dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, pos); - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, pos, 0, 0); + /* resolve link to a device and return its syspath */ + util_strscpyl(path, sizeof(path), udev_device->syspath, "/", sysattr, NULL); + dev = udev_device_new_from_syspath(udev_device->udev, path); + if (dev != NULL) { + list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, + udev_device_get_syspath(dev)); val = udev_list_entry_get_value(list_entry); + udev_device_unref(dev); } goto out; @@ -1229,12 +1429,77 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const value[size] = '\0'; util_remove_trailing_chars(value, '\n'); dbg(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, value, 0, 0); + list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, value); val = udev_list_entry_get_value(list_entry); out: return val; } +static int udev_device_sysattr_list_read(struct udev_device *udev_device) +{ + struct dirent *dent; + DIR *dir; + int num = 0; + + if (udev_device == NULL) + return -1; + if (udev_device->sysattr_list_read) + return 0; + + dir = opendir(udev_device_get_syspath(udev_device)); + if (!dir) { + dbg(udev_device->udev, "sysfs dir '%s' can not be opened\n", + udev_device_get_syspath(udev_device)); + return -1; + } + + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char path[UTIL_PATH_SIZE]; + struct stat statbuf; + + /* only handle symlinks and regular files */ + if (dent->d_type != DT_LNK && dent->d_type != DT_REG) + continue; + + util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", dent->d_name, NULL); + if (lstat(path, &statbuf) != 0) + continue; + if ((statbuf.st_mode & S_IRUSR) == 0) + continue; + + udev_list_entry_add(&udev_device->sysattr_list, dent->d_name, NULL); + num++; + } + + closedir(dir); + dbg(udev_device->udev, "found %d sysattrs for '%s'\n", num, udev_device_get_syspath(udev_device)); + udev_device->sysattr_list_read = true; + + return num; +} + +/** + * udev_device_get_sysattr_list_entry: + * @udev_device: udev device + * + * Retrieve the list of available sysattrs, with value being empty; + * This just return all available sysfs attributes for a particular + * device without reading their values. + * + * Returns: the first entry of the property list + **/ +UDEV_EXPORT struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device) +{ + if (!udev_device->sysattr_list_read) { + int ret; + ret = udev_device_sysattr_list_read(udev_device); + if (0 > ret) + return NULL; + } + + return udev_list_get_entry(&udev_device->sysattr_list); +} + int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath) { const char *pos; @@ -1273,28 +1538,6 @@ int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath return 0; } -int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem) -{ - free(udev_device->subsystem); - udev_device->subsystem = strdup(subsystem); - if (udev_device->subsystem == NULL) - return -ENOMEM; - udev_device->subsystem_set = true; - udev_device_add_property(udev_device, "SUBSYSTEM", udev_device->subsystem); - return 0; -} - -int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype) -{ - free(udev_device->devtype); - udev_device->devtype = strdup(devtype); - if (udev_device->devtype == NULL) - return -ENOMEM; - udev_device->devtype_set = true; - udev_device_add_property(udev_device, "DEVTYPE", udev_device->devtype); - return 0; -} - int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode) { free(udev_device->devnode); @@ -1310,11 +1553,11 @@ int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink struct udev_list_entry *list_entry; udev_device->devlinks_uptodate = false; - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->devlinks_list, devlink, NULL, 1, 0); + list_entry = udev_list_entry_add(&udev_device->devlinks_list, devlink, NULL); if (list_entry == NULL) return -ENOMEM; if (unique) - udev_list_entry_set_flags(list_entry, 1); + udev_list_entry_set_num(list_entry, true); return 0; } @@ -1365,10 +1608,10 @@ const char *udev_device_get_id_filename(struct udev_device *udev_device) * * Returns: 1 if the device is set up. 0 otherwise. **/ -int udev_device_get_is_initialized(struct udev_device *udev_device) +UDEV_EXPORT int udev_device_get_is_initialized(struct udev_device *udev_device) { if (!udev_device->info_loaded) - udev_device_read_db(udev_device); + udev_device_read_db(udev_device, NULL); return udev_device->is_initialized; } @@ -1382,7 +1625,7 @@ int udev_device_add_tag(struct udev_device *udev_device, const char *tag) if (strchr(tag, ':') != NULL || strchr(tag, ' ') != NULL) return -EINVAL; udev_device->tags_uptodate = false; - if (udev_list_entry_add(udev_device->udev, &udev_device->tags_list, tag, NULL, 1, 0) != NULL) + if (udev_list_entry_add(&udev_device->tags_list, tag, NULL) != NULL) return 0; return -ENOMEM; } @@ -1390,7 +1633,7 @@ int udev_device_add_tag(struct udev_device *udev_device, const char *tag) void udev_device_cleanup_tags_list(struct udev_device *udev_device) { udev_device->tags_uptodate = false; - udev_list_cleanup_entries(udev_device->udev, &udev_device->tags_list); + udev_list_cleanup(&udev_device->tags_list); } /** @@ -1404,24 +1647,27 @@ void udev_device_cleanup_tags_list(struct udev_device *udev_device) * * Returns: the first entry of the tag list **/ -struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device) +UDEV_EXPORT struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; + if (!udev_device->info_loaded) + udev_device_read_db(udev_device, NULL); return udev_list_get_entry(&udev_device->tags_list); } -int udev_device_has_tag(struct udev_device *udev_device, const char *tag) +UDEV_EXPORT int udev_device_has_tag(struct udev_device *udev_device, const char *tag) { struct udev_list_entry *list_entry; + if (udev_device == NULL) + return false; if (!udev_device->info_loaded) - udev_device_read_db(udev_device); + udev_device_read_db(udev_device, NULL); list_entry = udev_device_get_tags_list_entry(udev_device); - list_entry = udev_list_entry_get_by_name(list_entry, tag); - if (list_entry != NULL) - return 1; - return 0; + if (udev_list_entry_get_by_name(list_entry, tag) != NULL) + return true; + return false; } #define ENVP_SIZE 128 @@ -1505,128 +1751,10 @@ int udev_device_set_action(struct udev_device *udev_device, const char *action) return 0; } -int udev_device_set_driver(struct udev_device *udev_device, const char *driver) -{ - free(udev_device->driver); - udev_device->driver = strdup(driver); - if (udev_device->driver == NULL) - return -ENOMEM; - udev_device->driver_set = true; - udev_device_add_property(udev_device, "DRIVER", udev_device->driver); - return 0; -} - -const char *udev_device_get_devpath_old(struct udev_device *udev_device) -{ - return udev_device->devpath_old; -} - -int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old) -{ - const char *pos; - size_t len; - - free(udev_device->devpath_old); - udev_device->devpath_old = strdup(devpath_old); - if (udev_device->devpath_old == NULL) - return -ENOMEM; - udev_device_add_property(udev_device, "DEVPATH_OLD", udev_device->devpath_old); - - pos = strrchr(udev_device->devpath_old, '/'); - if (pos == NULL) - return -EINVAL; - udev_device->sysname_old = strdup(&pos[1]); - if (udev_device->sysname_old == NULL) - return -ENOMEM; - - /* some devices have '!' in their name, change that to '/' */ - len = 0; - while (udev_device->sysname_old[len] != '\0') { - if (udev_device->sysname_old[len] == '!') - udev_device->sysname_old[len] = '/'; - len++; - } - return 0; -} - -const char *udev_device_get_sysname_old(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - return udev_device->sysname_old; -} - -const char *udev_device_get_knodename(struct udev_device *udev_device) -{ - return udev_device->knodename; -} - -int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename) -{ - free(udev_device->knodename); - udev_device->knodename = strdup(knodename); - if (udev_device->knodename == NULL) - return -ENOMEM; - /* do not overwrite the udev property with the kernel property */ - if (udev_device->devnode == NULL) - udev_device_add_property(udev_device, "DEVNAME", udev_device->knodename); - return 0; -} - -int udev_device_get_timeout(struct udev_device *udev_device) -{ - return udev_device->timeout; -} - -int udev_device_set_timeout(struct udev_device *udev_device, int timeout) -{ - udev_device->timeout = timeout; - return 0; -} -int udev_device_get_event_timeout(struct udev_device *udev_device) -{ - if (!udev_device->info_loaded) - udev_device_read_db(udev_device); - return udev_device->event_timeout; -} - -int udev_device_set_event_timeout(struct udev_device *udev_device, int event_timeout) -{ - char num[32]; - - udev_device->event_timeout = event_timeout; - snprintf(num, sizeof(num), "%u", event_timeout); - udev_device_add_property(udev_device, "TIMEOUT", num); - return 0; -} - -int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum) -{ - char num[32]; - - udev_device->seqnum = seqnum; - snprintf(num, sizeof(num), "%llu", seqnum); - udev_device_add_property(udev_device, "SEQNUM", num); - return 0; -} - -int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) -{ - char num[32]; - - udev_device->devnum = devnum; - - snprintf(num, sizeof(num), "%u", major(devnum)); - udev_device_add_property(udev_device, "MAJOR", num); - snprintf(num, sizeof(num), "%u", minor(devnum)); - udev_device_add_property(udev_device, "MINOR", num); - return 0; -} - int udev_device_get_devlink_priority(struct udev_device *udev_device) { if (!udev_device->info_loaded) - udev_device_read_db(udev_device); + udev_device_read_db(udev_device, NULL); return udev_device->devlink_priority; } @@ -1639,7 +1767,7 @@ int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio) int udev_device_get_watch_handle(struct udev_device *udev_device) { if (!udev_device->info_loaded) - udev_device_read_db(udev_device); + udev_device_read_db(udev_device, NULL); return udev_device->watch_handle; } @@ -1649,19 +1777,12 @@ int udev_device_set_watch_handle(struct udev_device *udev_device, int handle) return 0; } -int udev_device_get_ifindex(struct udev_device *udev_device) +bool udev_device_get_db_persist(struct udev_device *udev_device) { - if (!udev_device->info_loaded) - udev_device_read_uevent_file(udev_device); - return udev_device->ifindex; + return udev_device->db_persist; } -int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex) +void udev_device_set_db_persist(struct udev_device *udev_device) { - char num[32]; - - udev_device->ifindex = ifindex; - snprintf(num, sizeof(num), "%u", ifindex); - udev_device_add_property(udev_device, "IFINDEX", num); - return 0; + udev_device->db_persist = true; } diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index e46bc08..f14d5c8 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -45,14 +45,15 @@ struct syspath { struct udev_enumerate { struct udev *udev; int refcount; - struct udev_list_node sysattr_match_list; - struct udev_list_node sysattr_nomatch_list; - struct udev_list_node subsystem_match_list; - struct udev_list_node subsystem_nomatch_list; - struct udev_list_node sysname_match_list; - struct udev_list_node properties_match_list; - struct udev_list_node tags_match_list; - struct udev_list_node devices_list; + struct udev_list sysattr_match_list; + struct udev_list sysattr_nomatch_list; + struct udev_list subsystem_match_list; + struct udev_list subsystem_nomatch_list; + struct udev_list sysname_match_list; + struct udev_list properties_match_list; + struct udev_list tags_match_list; + struct udev_device *parent_match; + struct udev_list devices_list; struct syspath *devices; unsigned int devices_cur; unsigned int devices_max; @@ -66,7 +67,7 @@ struct udev_enumerate { * * Returns: an enumeration context **/ -struct udev_enumerate *udev_enumerate_new(struct udev *udev) +UDEV_EXPORT struct udev_enumerate *udev_enumerate_new(struct udev *udev) { struct udev_enumerate *udev_enumerate; @@ -75,14 +76,14 @@ struct udev_enumerate *udev_enumerate_new(struct udev *udev) return NULL; udev_enumerate->refcount = 1; udev_enumerate->udev = udev; - udev_list_init(&udev_enumerate->sysattr_match_list); - udev_list_init(&udev_enumerate->sysattr_nomatch_list); - udev_list_init(&udev_enumerate->subsystem_match_list); - udev_list_init(&udev_enumerate->subsystem_nomatch_list); - udev_list_init(&udev_enumerate->sysname_match_list); - udev_list_init(&udev_enumerate->properties_match_list); - udev_list_init(&udev_enumerate->tags_match_list); - udev_list_init(&udev_enumerate->devices_list); + udev_list_init(udev, &udev_enumerate->sysattr_match_list, false); + udev_list_init(udev, &udev_enumerate->sysattr_nomatch_list, false); + udev_list_init(udev, &udev_enumerate->subsystem_match_list, true); + udev_list_init(udev, &udev_enumerate->subsystem_nomatch_list, true); + udev_list_init(udev, &udev_enumerate->sysname_match_list, true); + udev_list_init(udev, &udev_enumerate->properties_match_list, false); + udev_list_init(udev, &udev_enumerate->tags_match_list, true); + udev_list_init(udev, &udev_enumerate->devices_list, false); return udev_enumerate; } @@ -94,7 +95,7 @@ struct udev_enumerate *udev_enumerate_new(struct udev *udev) * * Returns: the passed enumeration context **/ -struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) +UDEV_EXPORT struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) { if (udev_enumerate == NULL) return NULL; @@ -109,7 +110,7 @@ struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) * Drop a reference of an enumeration context. If the refcount reaches zero, * all resources of the enumeration context will be released. **/ -void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) +UDEV_EXPORT void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) { unsigned int i; @@ -118,14 +119,15 @@ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) udev_enumerate->refcount--; if (udev_enumerate->refcount > 0) return; - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysattr_match_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysattr_nomatch_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_match_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_nomatch_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysname_match_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->properties_match_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->tags_match_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); + udev_list_cleanup(&udev_enumerate->sysattr_match_list); + udev_list_cleanup(&udev_enumerate->sysattr_nomatch_list); + udev_list_cleanup(&udev_enumerate->subsystem_match_list); + udev_list_cleanup(&udev_enumerate->subsystem_nomatch_list); + udev_list_cleanup(&udev_enumerate->sysname_match_list); + udev_list_cleanup(&udev_enumerate->properties_match_list); + udev_list_cleanup(&udev_enumerate->tags_match_list); + udev_device_unref(udev_enumerate->parent_match); + udev_list_cleanup(&udev_enumerate->devices_list); for (i = 0; i < udev_enumerate->devices_cur; i++) free(udev_enumerate->devices[i].syspath); free(udev_enumerate->devices); @@ -138,7 +140,7 @@ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) * * Returns: the udev library context. */ -struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate) +UDEV_EXPORT struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate) { if (udev_enumerate == NULL) return NULL; @@ -247,7 +249,7 @@ static size_t devices_delay_later(struct udev *udev, const char *syspath) * * Returns: the first entry of the sorted list of device paths. */ -struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate) +UDEV_EXPORT struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate) { if (udev_enumerate == NULL) return NULL; @@ -257,7 +259,7 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude struct syspath *prev = NULL, *move_later = NULL; size_t move_later_prefix = 0; - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); + udev_list_cleanup(&udev_enumerate->devices_list); qsort(udev_enumerate->devices, udev_enumerate->devices_cur, sizeof(struct syspath), syspath_cmp); max = udev_enumerate->devices_cur; @@ -274,6 +276,8 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude /* skip to be delayed devices, and add them to the end of the list */ if (devices_delay_end(udev_enumerate->udev, entry->syspath)) { syspath_add(udev_enumerate, entry->syspath); + /* need to update prev here for the case realloc() gives a different address */ + prev = &udev_enumerate->devices[i]; continue; } @@ -292,25 +296,21 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude if (move_later && strncmp(entry->syspath, move_later->syspath, move_later_prefix) != 0) { - udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list, - move_later->syspath, NULL, 0, 0); + udev_list_entry_add(&udev_enumerate->devices_list, move_later->syspath, NULL); move_later = NULL; } - udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list, - entry->syspath, NULL, 0, 0); + udev_list_entry_add(&udev_enumerate->devices_list, entry->syspath, NULL); } if (move_later) - udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list, - move_later->syspath, NULL, 0, 0); + udev_list_entry_add(&udev_enumerate->devices_list, move_later->syspath, NULL); /* add and cleanup delayed devices from end of list */ for (i = max; i < udev_enumerate->devices_cur; i++) { struct syspath *entry = &udev_enumerate->devices[i]; - udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list, - entry->syspath, NULL, 0, 0); + udev_list_entry_add(&udev_enumerate->devices_list, entry->syspath, NULL); free(entry->syspath); } udev_enumerate->devices_cur = max; @@ -327,14 +327,13 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) +UDEV_EXPORT int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) { if (udev_enumerate == NULL) return -EINVAL; if (subsystem == NULL) return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->subsystem_match_list, subsystem, NULL, 1, 0) == NULL) + if (udev_list_entry_add(&udev_enumerate->subsystem_match_list, subsystem, NULL) == NULL) return -ENOMEM; return 0; } @@ -346,14 +345,13 @@ int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, co * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) +UDEV_EXPORT int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) { if (udev_enumerate == NULL) return -EINVAL; if (subsystem == NULL) return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->subsystem_nomatch_list, subsystem, NULL, 1, 0) == NULL) + if (udev_list_entry_add(&udev_enumerate->subsystem_nomatch_list, subsystem, NULL) == NULL) return -ENOMEM; return 0; } @@ -366,14 +364,13 @@ int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) +UDEV_EXPORT int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) { if (udev_enumerate == NULL) return -EINVAL; if (sysattr == NULL) return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->sysattr_match_list, sysattr, value, 0, 0) == NULL) + if (udev_list_entry_add(&udev_enumerate->sysattr_match_list, sysattr, value) == NULL) return -ENOMEM; return 0; } @@ -386,14 +383,13 @@ int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, cons * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) +UDEV_EXPORT int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) { if (udev_enumerate == NULL) return -EINVAL; if (sysattr == NULL) return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->sysattr_nomatch_list, sysattr, value, 0, 0) == NULL) + if (udev_list_entry_add(&udev_enumerate->sysattr_nomatch_list, sysattr, value) == NULL) return -ENOMEM; return 0; } @@ -426,14 +422,13 @@ exit: * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value) +UDEV_EXPORT int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value) { if (udev_enumerate == NULL) return -EINVAL; if (property == NULL) return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->properties_match_list, property, value, 0, 0) == NULL) + if (udev_list_entry_add(&udev_enumerate->properties_match_list, property, value) == NULL) return -ENOMEM; return 0; } @@ -445,19 +440,43 @@ int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, con * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag) +UDEV_EXPORT int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag) { if (udev_enumerate == NULL) return -EINVAL; if (tag == NULL) return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->tags_match_list, tag, NULL, 1, 0) == NULL) + if (udev_list_entry_add(&udev_enumerate->tags_match_list, tag, NULL) == NULL) return -ENOMEM; return 0; } /** + * udev_enumerate_add_match_parent: + * @udev_enumerate: context + * @parent: parent device where to start searching + * + * Return the devices on the subtree of one given device. The parent + * itself is included in the list. + * + * A reference for the device is held until the udev_enumerate context + * is cleaned up. + * + * Returns: 0 on success, otherwise a negative error value. + */ +UDEV_EXPORT int udev_enumerate_add_match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *parent) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (parent == NULL) + return 0; + if (udev_enumerate->parent_match != NULL) + udev_device_unref(udev_enumerate->parent_match); + udev_enumerate->parent_match = udev_device_ref(parent); + return 0; +} + +/** * udev_enumerate_add_match_is_initialized: * @udev_enumerate: context * @@ -475,7 +494,7 @@ int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const ch * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate) +UDEV_EXPORT int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate) { if (udev_enumerate == NULL) return -EINVAL; @@ -490,14 +509,13 @@ int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerat * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) +UDEV_EXPORT int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) { if (udev_enumerate == NULL) return -EINVAL; if (sysname == NULL) return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->sysname_match_list, sysname, NULL, 1, 0) == NULL) + if (udev_list_entry_add(&udev_enumerate->sysname_match_list, sysname, NULL) == NULL) return -ENOMEM; return 0; } @@ -579,6 +597,17 @@ static bool match_tag(struct udev_enumerate *udev_enumerate, struct udev_device return true; } +static bool match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *dev) +{ + const char *parent; + + if (udev_enumerate->parent_match == NULL) + return true; + + parent = udev_device_get_devpath(udev_enumerate->parent_match); + return strncmp(parent, udev_device_get_devpath(dev), strlen(parent)) == 0; +} + static bool match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) { struct udev_list_entry *list_entry; @@ -643,6 +672,8 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, (major(udev_device_get_devnum(dev)) > 0 || udev_device_get_ifindex(dev) > 0)) goto nomatch; } + if (!match_parent(udev_enumerate, dev)) + goto nomatch; if (!match_tag(udev_enumerate, dev)) goto nomatch; if (!match_property(udev_enumerate, dev)) @@ -708,7 +739,7 @@ static int scan_dir(struct udev_enumerate *udev_enumerate, const char *basedir, * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath) +UDEV_EXPORT int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath) { struct udev_device *udev_device; @@ -725,73 +756,161 @@ int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char return 0; } -/** - * udev_enumerate_scan_devices: - * @udev_enumerate: udev enumeration context - * - * Returns: 0 on success, otherwise a negative error value. - **/ -int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) +static int scan_devices_tags(struct udev_enumerate *udev_enumerate) { struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - char base[UTIL_PATH_SIZE]; - struct stat statbuf; + struct udev_list_entry *list_entry; - if (udev_enumerate == NULL) - return -EINVAL; + /* scan only tagged devices, use tags reverse-index, instead of searching all devices in /sys */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->tags_match_list)) { + DIR *dir; + struct dirent *dent; + char path[UTIL_PATH_SIZE]; - if (udev_list_get_entry(&udev_enumerate->tags_match_list) != NULL) { - struct udev_list_entry *list_entry; + util_strscpyl(path, sizeof(path), udev_get_run_path(udev), "/tags/", + udev_list_entry_get_name(list_entry), NULL); + dir = opendir(path); + if (dir == NULL) + continue; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + struct udev_device *dev; - /* scan only tagged devices, use tags reverse-index, instead of searching all devices in /sys */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->tags_match_list)) { - DIR *dir; - struct dirent *dent; - char path[UTIL_PATH_SIZE]; + if (dent->d_name[0] == '.') + continue; - util_strscpyl(path, sizeof(path), udev_get_dev_path(udev), "/.udev/tags/", - udev_list_entry_get_name(list_entry), NULL); - dir = opendir(path); - if (dir == NULL) + dev = udev_device_new_from_id_filename(udev_enumerate->udev, dent->d_name); + if (dev == NULL) continue; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - struct udev_device *dev; - if (dent->d_name[0] == '.') - continue; + if (!match_subsystem(udev_enumerate, udev_device_get_subsystem(dev))) + goto nomatch; + if (!match_sysname(udev_enumerate, udev_device_get_sysname(dev))) + goto nomatch; + if (!match_parent(udev_enumerate, dev)) + goto nomatch; + if (!match_property(udev_enumerate, dev)) + goto nomatch; + if (!match_sysattr(udev_enumerate, dev)) + goto nomatch; - dev = udev_device_new_from_id_filename(udev_enumerate->udev, dent->d_name); - if (dev == NULL) - continue; - syspath_add(udev_enumerate, udev_device_get_syspath(dev)); - udev_device_unref(dev); - } - closedir(dir); + syspath_add(udev_enumerate, udev_device_get_syspath(dev)); +nomatch: + udev_device_unref(dev); } + closedir(dir); + } + return 0; +} + +static int parent_add_child(struct udev_enumerate *enumerate, const char *path) +{ + struct udev_device *dev; + + dev = udev_device_new_from_syspath(enumerate->udev, path); + if (dev == NULL) + return -ENODEV; + + if (!match_subsystem(enumerate, udev_device_get_subsystem(dev))) + return 0; + if (!match_sysname(enumerate, udev_device_get_sysname(dev))) + return 0; + if (!match_property(enumerate, dev)) + return 0; + if (!match_sysattr(enumerate, dev)) + return 0; + + syspath_add(enumerate, udev_device_get_syspath(dev)); + udev_device_unref(dev); + return 1; +} + +static int parent_crawl_children(struct udev_enumerate *enumerate, const char *path, int maxdepth) +{ + DIR *d; + struct dirent *dent; + + d = opendir(path); + if (d == NULL) + return -errno; + + for (dent = readdir(d); dent != NULL; dent = readdir(d)) { + char *child; + + if (dent->d_name[0] == '.') + continue; + if (dent->d_type != DT_DIR) + continue; + if (asprintf(&child, "%s/%s", path, dent->d_name) < 0) + continue; + parent_add_child(enumerate, child); + if (maxdepth > 0) + parent_crawl_children(enumerate, child, maxdepth-1); + free(child); + } + + closedir(d); + return 0; +} + +static int scan_devices_children(struct udev_enumerate *enumerate) +{ + const char *path; + + path = udev_device_get_syspath(enumerate->parent_match); + parent_add_child(enumerate, path); + return parent_crawl_children(enumerate, path, 256); +} + +static int scan_devices_all(struct udev_enumerate *udev_enumerate) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + char base[UTIL_PATH_SIZE]; + struct stat statbuf; + + util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); + if (stat(base, &statbuf) == 0) { + /* we have /subsystem/, forget all the old stuff */ + dbg(udev, "searching '/subsystem/*/devices/*' dir\n"); + scan_dir(udev_enumerate, "subsystem", "devices", NULL); } else { - util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); - if (stat(base, &statbuf) == 0) { - /* we have /subsystem/, forget all the old stuff */ - dbg(udev, "searching '/subsystem/*/devices/*' dir\n"); - scan_dir(udev_enumerate, "subsystem", "devices", NULL); - } else { dbg(udev, "searching '/bus/*/devices/*' dir\n"); - scan_dir(udev_enumerate, "bus", "devices", NULL); - dbg(udev, "searching '/class/*' dir\n"); - scan_dir(udev_enumerate, "class", NULL, NULL); - } + scan_dir(udev_enumerate, "bus", "devices", NULL); + dbg(udev, "searching '/class/*' dir\n"); + scan_dir(udev_enumerate, "class", NULL, NULL); } - return 0; } /** + * udev_enumerate_scan_devices: + * @udev_enumerate: udev enumeration context + * + * Returns: 0 on success, otherwise a negative error value. + **/ +UDEV_EXPORT int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) +{ + if (udev_enumerate == NULL) + return -EINVAL; + + /* efficiently lookup tags only, we maintain a reverse-index */ + if (udev_list_get_entry(&udev_enumerate->tags_match_list) != NULL) + return scan_devices_tags(udev_enumerate); + + /* walk the subtree of one parent device only */ + if (udev_enumerate->parent_match != NULL) + return scan_devices_children(udev_enumerate); + + /* scan devices of all subsystems */ + return scan_devices_all(udev_enumerate); +} + +/** * udev_enumerate_scan_subsystems: * @udev_enumerate: udev enumeration context * * Returns: 0 on success, otherwise a negative error value. **/ -int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) +UDEV_EXPORT int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) { struct udev *udev = udev_enumerate_get_udev(udev_enumerate); char base[UTIL_PATH_SIZE]; @@ -801,15 +920,25 @@ int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) if (udev_enumerate == NULL) return -EINVAL; + /* all kernel modules */ + if (match_subsystem(udev_enumerate, "module")) { + dbg(udev, "searching '%s/modules/*' dir\n", subsysdir); + scan_dir_and_add_devices(udev_enumerate, "module", NULL, NULL); + } + util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); if (stat(base, &statbuf) == 0) subsysdir = "subsystem"; else subsysdir = "bus"; + + /* all subsystems (only buses support coldplug) */ if (match_subsystem(udev_enumerate, "subsystem")) { dbg(udev, "searching '%s/*' dir\n", subsysdir); scan_dir_and_add_devices(udev_enumerate, subsysdir, NULL, NULL); } + + /* all subsystem drivers */ if (match_subsystem(udev_enumerate, "drivers")) { dbg(udev, "searching '%s/*/drivers/*' dir\n", subsysdir); scan_dir(udev_enumerate, subsysdir, "drivers", "drivers"); diff --git a/libudev/libudev-list.c b/libudev/libudev-list.c index b5e9645..f74a88c 100644 --- a/libudev/libudev-list.c +++ b/libudev/libudev-list.c @@ -34,21 +34,20 @@ */ struct udev_list_entry { struct udev_list_node node; - struct udev *udev; - struct udev_list_node *list; + struct udev_list *list; char *name; char *value; - unsigned int flags; + int num; }; -/* list head point to itself if empty */ -void udev_list_init(struct udev_list_node *list) +/* the list's head points to itself if empty */ +void udev_list_node_init(struct udev_list_node *list) { list->next = list; list->prev = list; } -int udev_list_is_empty(struct udev_list_node *list) +int udev_list_node_is_empty(struct udev_list_node *list) { return list->next == list; } @@ -90,19 +89,20 @@ static struct udev_list_entry *list_node_to_entry(struct udev_list_node *node) return (struct udev_list_entry *)list; } -/* insert entry into a list as the last element */ -void udev_list_entry_append(struct udev_list_entry *new, struct udev_list_node *list) +void udev_list_init(struct udev *udev, struct udev_list *list, bool unique) { - /* inserting before the list head make the node the last node in the list */ - udev_list_node_insert_between(&new->node, list->prev, list); - new->list = list; + memset(list, 0x00, sizeof(struct udev_list)); + list->udev = udev; + list->unique = unique; + udev_list_node_init(&list->node); } -/* remove entry from a list */ -void udev_list_entry_remove(struct udev_list_entry *entry) +/* insert entry into a list as the last element */ +void udev_list_entry_append(struct udev_list_entry *new, struct udev_list *list) { - udev_list_node_remove(&entry->node); - entry->list = NULL; + /* inserting before the list head make the node the last node in the list */ + udev_list_node_insert_between(&new->node, list->node.prev, &list->node); + new->list = list; } /* insert entry into a list, before a given existing entry */ @@ -112,85 +112,153 @@ void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list new->list = entry->list; } -struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_node *list, - const char *name, const char *value, - int unique, int sort) +/* binary search in sorted array */ +static int list_search(struct udev_list *list, const char *name) { - struct udev_list_entry *entry_loop = NULL; - struct udev_list_entry *entry_new; - - if (unique) - udev_list_entry_foreach(entry_loop, udev_list_get_entry(list)) { - if (strcmp(entry_loop->name, name) == 0) { - dbg(udev, "'%s' is already in the list\n", name); - free(entry_loop->value); - if (value == NULL) { - entry_loop->value = NULL; - dbg(udev, "'%s' value unset\n", name); - return entry_loop; - } - entry_loop->value = strdup(value); - if (entry_loop->value == NULL) - return NULL; - dbg(udev, "'%s' value replaced with '%s'\n", name, value); - return entry_loop; - } - } + unsigned int first, last; + + first = 0; + last = list->entries_cur; + while (first < last) { + unsigned int i; + int cmp; + + i = (first + last)/2; + cmp = strcmp(name, list->entries[i]->name); + if (cmp < 0) + last = i; + else if (cmp > 0) + first = i+1; + else + return i; + } + + /* not found, return negative insertion-index+1 */ + return -(first+1); +} - if (sort) - udev_list_entry_foreach(entry_loop, udev_list_get_entry(list)) { - if (strcmp(entry_loop->name, name) > 0) - break; +struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *name, const char *value) +{ + struct udev_list_entry *entry; + int i = 0; + + if (list->unique) { + /* lookup existing name or insertion-index */ + i = list_search(list, name); + if (i >= 0) { + entry = list->entries[i]; + + dbg(list->udev, "'%s' is already in the list\n", name); + free(entry->value); + if (value == NULL) { + entry->value = NULL; + dbg(list->udev, "'%s' value unset\n", name); + return entry; + } + entry->value = strdup(value); + if (entry->value == NULL) + return NULL; + dbg(list->udev, "'%s' value replaced with '%s'\n", name, value); + return entry; } + } - entry_new = malloc(sizeof(struct udev_list_entry)); - if (entry_new == NULL) + /* add new name */ + entry = calloc(1, sizeof(struct udev_list_entry)); + if (entry == NULL) return NULL; - memset(entry_new, 0x00, sizeof(struct udev_list_entry)); - entry_new->udev = udev; - entry_new->name = strdup(name); - if (entry_new->name == NULL) { - free(entry_new); + entry->name = strdup(name); + if (entry->name == NULL) { + free(entry); return NULL; } if (value != NULL) { - entry_new->value = strdup(value); - if (entry_new->value == NULL) { - free(entry_new->name); - free(entry_new); + entry->value = strdup(value); + if (entry->value == NULL) { + free(entry->name); + free(entry); return NULL; } } - if (entry_loop != NULL) - udev_list_entry_insert_before(entry_new, entry_loop); - else - udev_list_entry_append(entry_new, list); - dbg(udev, "'%s=%s' added\n", entry_new->name, entry_new->value); - return entry_new; + + if (list->unique) { + /* allocate or enlarge sorted array if needed */ + if (list->entries_cur >= list->entries_max) { + unsigned int add; + + add = list->entries_max; + if (add < 1) + add = 64; + list->entries = realloc(list->entries, (list->entries_max + add) * sizeof(struct udev_list_entry *)); + if (list->entries == NULL) { + free(entry->name); + free(entry->value); + return NULL; + } + list->entries_max += add; + } + + /* the negative i returned the insertion index */ + i = (-i)-1; + + /* insert into sorted list */ + if ((unsigned int)i < list->entries_cur) + udev_list_entry_insert_before(entry, list->entries[i]); + else + udev_list_entry_append(entry, list); + + /* insert into sorted array */ + memmove(&list->entries[i+1], &list->entries[i], + (list->entries_cur - i) * sizeof(struct udev_list_entry *)); + list->entries[i] = entry; + list->entries_cur++; + } else { + udev_list_entry_append(entry, list); + } + + dbg(list->udev, "'%s=%s' added\n", entry->name, entry->value); + return entry; } void udev_list_entry_delete(struct udev_list_entry *entry) { + if (entry->list->entries != NULL) { + int i; + struct udev_list *list = entry->list; + + /* remove entry from sorted array */ + i = list_search(list, entry->name); + if (i >= 0) { + memmove(&list->entries[i], &list->entries[i+1], + ((list->entries_cur-1) - i) * sizeof(struct udev_list_entry *)); + list->entries_cur--; + } + } + udev_list_node_remove(&entry->node); free(entry->name); free(entry->value); free(entry); } -void udev_list_cleanup_entries(struct udev *udev, struct udev_list_node *list) +void udev_list_cleanup(struct udev_list *list) { struct udev_list_entry *entry_loop; struct udev_list_entry *entry_tmp; + free(list->entries); + list->entries = NULL; + list->entries_cur = 0; + list->entries_max = 0; udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(list)) udev_list_entry_delete(entry_loop); } -struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list) +struct udev_list_entry *udev_list_get_entry(struct udev_list *list) { - if (udev_list_is_empty(list)) + if (udev_list_node_is_empty(&list->node)) return NULL; - return list_node_to_entry(list->next); + return list_node_to_entry(list->node.next); } /** @@ -199,7 +267,7 @@ struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list) * * Returns: the next entry from the list, #NULL is no more entries are found. */ -struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry) +UDEV_EXPORT struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry) { struct udev_list_node *next; @@ -207,7 +275,7 @@ struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_en return NULL; next = list_entry->node.next; /* empty list or no more entries */ - if (next == list_entry->list) + if (next == &list_entry->list->node) return NULL; return list_node_to_entry(next); } @@ -219,17 +287,20 @@ struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_en * * Returns: the entry where @name matched, #NULL if no matching entry is found. */ -struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name) +UDEV_EXPORT struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name) { - struct udev_list_entry *entry; + int i; - udev_list_entry_foreach(entry, list_entry) { - if (strcmp(udev_list_entry_get_name(entry), name) == 0) { - dbg(entry->udev, "found '%s=%s'\n", entry->name, entry->value); - return entry; - } - } - return NULL; + if (list_entry == NULL) + return NULL; + + if (!list_entry->list->unique) + return NULL; + + i = list_search(list_entry->list, name); + if (i < 0) + return NULL; + return list_entry->list->entries[i]; } /** @@ -238,7 +309,7 @@ struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list * * Returns: the name string of this entry. */ -const char *udev_list_entry_get_name(struct udev_list_entry *list_entry) +UDEV_EXPORT const char *udev_list_entry_get_name(struct udev_list_entry *list_entry) { if (list_entry == NULL) return NULL; @@ -251,23 +322,23 @@ const char *udev_list_entry_get_name(struct udev_list_entry *list_entry) * * Returns: the value string of this entry. */ -const char *udev_list_entry_get_value(struct udev_list_entry *list_entry) +UDEV_EXPORT const char *udev_list_entry_get_value(struct udev_list_entry *list_entry) { if (list_entry == NULL) return NULL; return list_entry->value; } -unsigned int udev_list_entry_get_flags(struct udev_list_entry *list_entry) +int udev_list_entry_get_num(struct udev_list_entry *list_entry) { if (list_entry == NULL) return -EINVAL; - return list_entry->flags; + return list_entry->num; } -void udev_list_entry_set_flags(struct udev_list_entry *list_entry, unsigned int flags) +void udev_list_entry_set_num(struct udev_list_entry *list_entry, int num) { if (list_entry == NULL) return; - list_entry->flags = flags; + list_entry->num = num; } diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index a3789c4..f2f39f9 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -37,7 +37,7 @@ /** * udev_monitor: * - * Opaque object handling one event source. + * Opaque object handling an event source. */ struct udev_monitor { struct udev *udev; @@ -48,8 +48,9 @@ struct udev_monitor { struct sockaddr_nl snl_destination; struct sockaddr_un sun; socklen_t addrlen; - struct udev_list_node filter_subsystem_list; - struct udev_list_node filter_tag_list; + struct udev_list filter_subsystem_list; + struct udev_list filter_tag_list; + bool bound; }; enum udev_monitor_netlink_group { @@ -91,8 +92,8 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev) return NULL; udev_monitor->refcount = 1; udev_monitor->udev = udev; - udev_list_init(&udev_monitor->filter_subsystem_list); - udev_list_init(&udev_monitor->filter_tag_list); + udev_list_init(udev, &udev_monitor->filter_subsystem_list, false); + udev_list_init(udev, &udev_monitor->filter_tag_list, true); return udev_monitor; } @@ -101,7 +102,12 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev) * @udev: udev library context * @socket_path: unix socket path * - * Create new udev monitor and connect to a specified socket. The + * This function should not be used in any new application. The + * kernel's netlink socket multiplexes messages to all interested + * clients. Creating custom sockets from udev to applications + * should be avoided. + * + * Create a new udev monitor and connect to a specified socket. The * path to a socket either points to an existing socket file, or if * the socket path starts with a '@' character, an abstract namespace * socket will be used. @@ -116,7 +122,7 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev) * * Returns: a new udev monitor, or #NULL, in case of an error **/ -struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path) +UDEV_EXPORT struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path) { struct udev_monitor *udev_monitor; struct stat statbuf; @@ -144,7 +150,7 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char util_strscpy(&udev_monitor->sun.sun_path[1], sizeof(udev_monitor->sun.sun_path)-1, socket_path); udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path)+1; } - udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0); + udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); if (udev_monitor->sock == -1) { err(udev, "error getting socket: %m\n"); free(udev_monitor); @@ -155,32 +161,7 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char return udev_monitor; } -/** - * udev_monitor_new_from_netlink: - * @udev: udev library context - * @name: name of event source - * - * Create new udev monitor and connect to a specified event - * source. Valid sources identifiers are "udev" and "kernel". - * - * Applications should usually not connect directly to the - * "kernel" events, because the devices might not be useable - * at that time, before udev has configured them, and created - * device nodes. - * - * Accessing devices at the same time as udev, might result - * in unpredictable behavior. - * - * The "udev" events are sent out after udev has finished its - * event processing, all rules have been processed, and needed - * device nodes are created. - * - * The initial refcount is 1, and needs to be decremented to - * release the resources of the udev monitor. - * - * Returns: a new udev monitor, or #NULL, in case of an error - **/ -struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name) +struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const char *name, int fd) { struct udev_monitor *udev_monitor; unsigned int group; @@ -201,11 +182,16 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char if (udev_monitor == NULL) return NULL; - udev_monitor->sock = socket(PF_NETLINK, SOCK_DGRAM|SOCK_CLOEXEC, NETLINK_KOBJECT_UEVENT); - if (udev_monitor->sock == -1) { - err(udev, "error getting socket: %m\n"); - free(udev_monitor); - return NULL; + if (fd < 0) { + udev_monitor->sock = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_KOBJECT_UEVENT); + if (udev_monitor->sock == -1) { + err(udev, "error getting socket: %m\n"); + free(udev_monitor); + return NULL; + } + } else { + udev_monitor->bound = true; + udev_monitor->sock = fd; } udev_monitor->snl.nl_family = AF_NETLINK; @@ -219,6 +205,33 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char return udev_monitor; } +/** + * udev_monitor_new_from_netlink: + * @udev: udev library context + * @name: name of event source + * + * Create new udev monitor and connect to a specified event + * source. Valid sources identifiers are "udev" and "kernel". + * + * Applications should usually not connect directly to the + * "kernel" events, because the devices might not be useable + * at that time, before udev has configured them, and created + * device nodes. Accessing devices at the same time as udev, + * might result in unpredictable behavior. The "udev" events + * are sent out after udev has finished its event processing, + * all rules have been processed, and needed device nodes are + * created. + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev monitor. + * + * Returns: a new udev monitor, or #NULL, in case of an error + **/ +UDEV_EXPORT struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name) +{ + return udev_monitor_new_from_netlink_fd(udev, name, -1); +} + static inline void bpf_stmt(struct sock_filter *inss, unsigned int *i, unsigned short code, unsigned int data) { @@ -246,11 +259,12 @@ static inline void bpf_jmp(struct sock_filter *inss, unsigned int *i, * udev_monitor_filter_update: * @udev_monitor: monitor * - * Update the installed filter. This might only be needed, if the filter was removed or changed. + * Update the installed socket filter. This is only needed, + * if the filter was removed or changed. * * Returns: 0 on success, otherwise a negative error value. */ -int udev_monitor_filter_update(struct udev_monitor *udev_monitor) +UDEV_EXPORT int udev_monitor_filter_update(struct udev_monitor *udev_monitor) { struct sock_filter ins[512]; struct sock_fprog filter; @@ -342,6 +356,7 @@ int udev_monitor_filter_update(struct udev_monitor *udev_monitor) bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); /* install filter */ + memset(&filter, 0x00, sizeof(filter)); filter.len = i; filter.filter = ins; err = setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)); @@ -361,18 +376,26 @@ int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct * * Returns: 0 on success, otherwise a negative error value. */ -int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) +UDEV_EXPORT int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) { - int err; + int err = 0; const int on = 1; if (udev_monitor->sun.sun_family != 0) { - err = bind(udev_monitor->sock, - (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen); + if (!udev_monitor->bound) { + err = bind(udev_monitor->sock, + (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen); + if (err == 0) + udev_monitor->bound = true; + } } else if (udev_monitor->snl.nl_family != 0) { udev_monitor_filter_update(udev_monitor); - err = bind(udev_monitor->sock, - (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl)); + if (!udev_monitor->bound) { + err = bind(udev_monitor->sock, + (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl)); + if (err == 0) + udev_monitor->bound = true; + } if (err == 0) { struct sockaddr_nl snl; socklen_t addrlen; @@ -410,7 +433,7 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) * * Returns: 0 on success, otherwise -1 on error. */ -int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size) +UDEV_EXPORT int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size) { if (udev_monitor == NULL) return -1; @@ -434,7 +457,7 @@ int udev_monitor_disconnect(struct udev_monitor *udev_monitor) * * Returns: the passed udev monitor **/ -struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor) +UDEV_EXPORT struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor) { if (udev_monitor == NULL) return NULL; @@ -451,7 +474,7 @@ struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor) * will be released. * **/ -void udev_monitor_unref(struct udev_monitor *udev_monitor) +UDEV_EXPORT void udev_monitor_unref(struct udev_monitor *udev_monitor) { if (udev_monitor == NULL) return; @@ -460,8 +483,8 @@ void udev_monitor_unref(struct udev_monitor *udev_monitor) return; if (udev_monitor->sock >= 0) close(udev_monitor->sock); - udev_list_cleanup_entries(udev_monitor->udev, &udev_monitor->filter_subsystem_list); - udev_list_cleanup_entries(udev_monitor->udev, &udev_monitor->filter_tag_list); + udev_list_cleanup(&udev_monitor->filter_subsystem_list); + udev_list_cleanup(&udev_monitor->filter_tag_list); dbg(udev_monitor->udev, "monitor %p released\n", udev_monitor); free(udev_monitor); } @@ -474,7 +497,7 @@ void udev_monitor_unref(struct udev_monitor *udev_monitor) * * Returns: the udev library context **/ -struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor) +UDEV_EXPORT struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor) { if (udev_monitor == NULL) return NULL; @@ -489,7 +512,7 @@ struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor) * * Returns: the socket file descriptor **/ -int udev_monitor_get_fd(struct udev_monitor *udev_monitor) +UDEV_EXPORT int udev_monitor_get_fd(struct udev_monitor *udev_monitor) { if (udev_monitor == NULL) return -1; @@ -541,16 +564,14 @@ tag: * Receive data from the udev monitor socket, allocate a new udev * device, fill in the received data, and return the device. * - * Only socket connections with uid=0 are accepted. The caller - * needs to make sure that there is data to read from the socket. - * The call will block until the socket becomes readable. + * Only socket connections with uid=0 are accepted. * * The initial refcount is 1, and needs to be decremented to * release the resources of the udev device. * * Returns: a new udev device, or #NULL, in case of an error **/ -struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor) +UDEV_EXPORT struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor) { struct udev_device *udev_device; struct msghdr smsg; @@ -626,7 +647,7 @@ retry: /* udev message needs proper version magic */ nlh = (struct udev_monitor_netlink_header *) buf; if (nlh->magic != htonl(UDEV_MONITOR_MAGIC)) { - err(udev_monitor->udev, "ignored a message from an invalid release of udevadm (%x != %x)\n", + err(udev_monitor->udev, "unrecognized message signature (%x != %x)\n", nlh->magic, htonl(UDEV_MONITOR_MAGIC)); return NULL; } @@ -796,21 +817,20 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, * @subsystem: the subsystem value to match the incoming devices against * @devtype: the devtype value to match the incoming devices against * - * This filer is efficiently executed inside the kernel, and libudev subscribers + * This filter is efficiently executed inside the kernel, and libudev subscribers * will usually not be woken up for devices which do not match. * * The filter must be installed before the monitor is switched to listening mode. * * Returns: 0 on success, otherwise a negative error value. */ -int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype) +UDEV_EXPORT int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype) { if (udev_monitor == NULL) return -EINVAL; if (subsystem == NULL) return -EINVAL; - if (udev_list_entry_add(udev_monitor->udev, - &udev_monitor->filter_subsystem_list, subsystem, devtype, 0, 0) == NULL) + if (udev_list_entry_add(&udev_monitor->filter_subsystem_list, subsystem, devtype) == NULL) return -ENOMEM; return 0; } @@ -820,21 +840,20 @@ int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_mo * @udev_monitor: the monitor * @tag: the name of a tag * - * This filer is efficiently executed inside the kernel, and libudev subscribers + * This filter is efficiently executed inside the kernel, and libudev subscribers * will usually not be woken up for devices which do not match. * * The filter must be installed before the monitor is switched to listening mode. * * Returns: 0 on success, otherwise a negative error value. */ -int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag) +UDEV_EXPORT int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag) { if (udev_monitor == NULL) return -EINVAL; if (tag == NULL) return -EINVAL; - if (udev_list_entry_add(udev_monitor->udev, - &udev_monitor->filter_tag_list, tag, NULL, 0, 0) == NULL) + if (udev_list_entry_add(&udev_monitor->filter_tag_list, tag, NULL) == NULL) return -ENOMEM; return 0; } @@ -847,10 +866,10 @@ int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const c * * Returns: 0 on success, otherwise a negative error value. */ -int udev_monitor_filter_remove(struct udev_monitor *udev_monitor) +UDEV_EXPORT int udev_monitor_filter_remove(struct udev_monitor *udev_monitor) { static struct sock_fprog filter = { 0, NULL }; - udev_list_cleanup_entries(udev_monitor->udev, &udev_monitor->filter_subsystem_list); + udev_list_cleanup(&udev_monitor->filter_subsystem_list); return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)); } diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index f95be53..ffc82cb 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -45,6 +45,8 @@ udev_log_null(struct udev *udev, const char *format, ...) {} # define err(udev, arg...) udev_log_null(udev, ## arg) #endif +#define UDEV_EXPORT __attribute__ ((visibility("default"))) + static inline void udev_log_init(const char *program_name) { openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON); @@ -61,15 +63,16 @@ void udev_log(struct udev *udev, const char *format, ...) __attribute__((format(printf, 6, 7))); const char *udev_get_rules_path(struct udev *udev); +const char *udev_get_run_config_path(struct udev *udev); +const char *udev_set_run_path(struct udev *udev, const char *path); struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value); struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); /* libudev-device.c */ struct udev_device *udev_device_new(struct udev *udev); struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id); +mode_t udev_device_get_devnode_mode(struct udev_device *udev_device); int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath); -int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem); -int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype); int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode); int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink, int unique); void udev_device_cleanup_devlinks_list(struct udev_device *udev_device); @@ -78,26 +81,16 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device, int udev_device_add_property_from_string_parse_finish(struct udev_device *udev_device); char **udev_device_get_properties_envp(struct udev_device *udev_device); ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf); -int udev_device_read_db(struct udev_device *udev_device); +int udev_device_read_db(struct udev_device *udev_device, const char *dbfile); int udev_device_read_uevent_file(struct udev_device *udev_device); int udev_device_set_action(struct udev_device *udev_device, const char *action); -int udev_device_set_driver(struct udev_device *udev_device, const char *driver); const char *udev_device_get_devpath_old(struct udev_device *udev_device); -const char *udev_device_get_sysname_old(struct udev_device *udev_device); -int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old); const char *udev_device_get_knodename(struct udev_device *udev_device); const char *udev_device_get_id_filename(struct udev_device *udev_device); void udev_device_set_is_initialized(struct udev_device *udev_device); int udev_device_add_tag(struct udev_device *udev_device, const char *tag); void udev_device_cleanup_tags_list(struct udev_device *udev_device); -int udev_device_has_tag(struct udev_device *udev_device, const char *tag); -int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename); int udev_device_get_timeout(struct udev_device *udev_device); -int udev_device_set_timeout(struct udev_device *udev_device, int timeout); -int udev_device_get_event_timeout(struct udev_device *udev_device); -int udev_device_set_event_timeout(struct udev_device *udev_device, int event_timeout); -int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum); -int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum); unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device); void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized); int udev_device_get_devlink_priority(struct udev_device *udev_device); @@ -105,8 +98,9 @@ int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio); int udev_device_get_watch_handle(struct udev_device *udev_device); int udev_device_set_watch_handle(struct udev_device *udev_device, int handle); int udev_device_get_ifindex(struct udev_device *udev_device); -int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex); void udev_device_set_info_loaded(struct udev_device *device); +bool udev_device_get_db_persist(struct udev_device *udev_device); +void udev_device_set_db_persist(struct udev_device *udev_device); /* libudev-device-private.c */ int udev_device_update_db(struct udev_device *udev_device); @@ -118,41 +112,23 @@ int udev_monitor_disconnect(struct udev_monitor *udev_monitor); int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor *sender); int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_monitor *destination, struct udev_device *udev_device); - -/* libudev-ctrl.c - daemon runtime setup */ -struct udev_ctrl; -struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path); -int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl); -struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl); -void udev_ctrl_unref(struct udev_ctrl *uctrl); -struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl); -int udev_ctrl_get_fd(struct udev_ctrl *uctrl); -int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority); -int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl); -int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl); -int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl); -int udev_ctrl_send_settle(struct udev_ctrl *uctrl); -int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key); -int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count); -struct udev_ctrl_msg; -struct udev_ctrl_msg *udev_ctrl_msg(struct udev_ctrl *uctrl); -struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl); -struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg); -void udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg); -pid_t udev_ctrl_get_settle(struct udev_ctrl_msg *ctrl_msg); -const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg); +struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const char *name, int fd); /* libudev-list.c */ struct udev_list_node { struct udev_list_node *next, *prev; }; -void udev_list_init(struct udev_list_node *list); -int udev_list_is_empty(struct udev_list_node *list); +struct udev_list { + struct udev *udev; + struct udev_list_node node; + struct udev_list_entry **entries; + unsigned int entries_cur; + unsigned int entries_max; + bool unique; +}; +#define UDEV_LIST(list) struct udev_list_node list = { &(list), &(list) } +void udev_list_node_init(struct udev_list_node *list); +int udev_list_node_is_empty(struct udev_list_node *list); void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list); void udev_list_node_remove(struct udev_list_node *entry); #define udev_list_node_foreach(node, list) \ @@ -163,17 +139,15 @@ void udev_list_node_remove(struct udev_list_node *entry); for (node = (list)->next, tmp = (node)->next; \ node != list; \ node = tmp, tmp = (tmp)->next) -struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_node *list, - const char *name, const char *value, - int unique, int sort); +void udev_list_init(struct udev *udev, struct udev_list *list, bool unique); +void udev_list_cleanup(struct udev_list *list); +struct udev_list_entry *udev_list_get_entry(struct udev_list *list); +struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *name, const char *value); void udev_list_entry_delete(struct udev_list_entry *entry); -void udev_list_entry_remove(struct udev_list_entry *entry); void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry); -void udev_list_entry_append(struct udev_list_entry *new, struct udev_list_node *list); -void udev_list_cleanup_entries(struct udev *udev, struct udev_list_node *name_list); -struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list); -unsigned int udev_list_entry_get_flags(struct udev_list_entry *list_entry); -void udev_list_entry_set_flags(struct udev_list_entry *list_entry, unsigned int flags); +void udev_list_entry_append(struct udev_list_entry *new, struct udev_list *list); +int udev_list_entry_get_num(struct udev_list_entry *list_entry); +void udev_list_entry_set_num(struct udev_list_entry *list_entry, int num); #define udev_list_entry_foreach_safe(entry, tmp, first) \ for (entry = first, tmp = udev_list_entry_get_next(entry); \ entry != NULL; \ @@ -187,19 +161,17 @@ ssize_t udev_queue_skip_devpath(FILE *queue_file); /* libudev-queue-private.c */ struct udev_queue_export *udev_queue_export_new(struct udev *udev); -void udev_queue_export_unref(struct udev_queue_export *udev_queue_export); +struct udev_queue_export *udev_queue_export_unref(struct udev_queue_export *udev_queue_export); void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export); int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); -int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); /* libudev-util.c */ #define UTIL_PATH_SIZE 1024 #define UTIL_NAME_SIZE 512 #define UTIL_LINE_SIZE 16384 #define UDEV_ALLOWED_CHARS_INPUT "/ $%?," -ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size); -ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size); +ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size); int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size); int util_log_priority(const char *priority); size_t util_path_encode(const char *src, char *dest, size_t size); @@ -209,24 +181,21 @@ size_t util_strpcpy(char **dest, size_t size, const char *src); size_t util_strpcpyl(char **dest, size_t size, const char *src, ...) __attribute__((sentinel)); size_t util_strscpy(char *dest, size_t size, const char *src); size_t util_strscpyl(char *dest, size_t size, const char *src, ...) __attribute__((sentinel)); -int udev_util_replace_whitespace(const char *str, char *to, size_t len); -int udev_util_replace_chars(char *str, const char *white); -int udev_util_encode_string(const char *str, char *str_enc, size_t len); +int util_replace_whitespace(const char *str, char *to, size_t len); +int util_replace_chars(char *str, const char *white); unsigned int util_string_hash32(const char *key); uint64_t util_string_bloom64(const char *str); /* libudev-util-private.c */ int util_create_path(struct udev *udev, const char *path); +int util_create_path_selinux(struct udev *udev, const char *path); int util_delete_path(struct udev *udev, const char *path); int util_unlink_secure(struct udev *udev, const char *filename); uid_t util_lookup_user(struct udev *udev, const char *user); gid_t util_lookup_group(struct udev *udev, const char *group); -int util_run_program(struct udev *udev, const char *command, char **envp, - char *result, size_t ressize, size_t *reslen, - const sigset_t *sigmask, bool reset_prio); int util_resolve_subsys_kernel(struct udev *udev, const char *string, char *result, size_t maxsize, int read_value); -unsigned long long usec_monotonic(void); +unsigned long long now_usec(void); /* libudev-selinux-private.c */ #ifndef WITH_SELINUX diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c index 06dc2f5..e0a7b53 100644 --- a/libudev/libudev-queue-private.c +++ b/libudev/libudev-queue-private.c @@ -56,7 +56,6 @@ static int rebuild_queue_file(struct udev_queue_export *udev_queue_export); struct udev_queue_export { struct udev *udev; - int failed_count; /* number of failed events exported */ int queued_count; /* number of unfinished events exported in queue file */ FILE *queue_file; unsigned long long int seqnum_max; /* earliest sequence number in queue file */ @@ -90,23 +89,25 @@ struct udev_queue_export *udev_queue_export_new(struct udev *udev) return udev_queue_export; } -void udev_queue_export_unref(struct udev_queue_export *udev_queue_export) +struct udev_queue_export *udev_queue_export_unref(struct udev_queue_export *udev_queue_export) { if (udev_queue_export == NULL) - return; + return NULL; if (udev_queue_export->queue_file != NULL) fclose(udev_queue_export->queue_file); free(udev_queue_export); + return NULL; } void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export) { char filename[UTIL_PATH_SIZE]; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.tmp", NULL); + if (udev_queue_export == NULL) + return; + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.tmp", NULL); unlink(filename); - - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.bin", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.bin", NULL); unlink(filename); } @@ -163,7 +164,7 @@ static struct queue_devpaths *build_index(struct udev_queue_export *udev_queue_e devpaths->devpaths_size = range + 1; /* read all records and populate the table */ - while(1) { + for (;;) { if (udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum) < 0) break; n = seqnum - udev_queue_export->seqnum_max; @@ -221,7 +222,7 @@ static int rebuild_queue_file(struct udev_queue_export *udev_queue_export) } /* create new queue file */ - util_strscpyl(filename_tmp, sizeof(filename_tmp), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.tmp", NULL); + util_strscpyl(filename_tmp, sizeof(filename_tmp), udev_get_run_path(udev_queue_export->udev), "/queue.tmp", NULL); new_queue_file = fopen(filename_tmp, "w+"); if (new_queue_file == NULL) goto error; @@ -255,7 +256,7 @@ static int rebuild_queue_file(struct udev_queue_export *udev_queue_export) goto error; /* rename the new file on top of the old one */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.bin", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.bin", NULL); if (rename(filename_tmp, filename) != 0) goto error; @@ -302,8 +303,10 @@ static int write_queue_record(struct udev_queue_export *udev_queue_export, len = (devpath_len < USHRT_MAX) ? devpath_len : USHRT_MAX; if (fwrite(&len, sizeof(unsigned short), 1, udev_queue_export->queue_file) != 1) goto write_error; - if (fwrite(devpath, 1, len, udev_queue_export->queue_file) != len) - goto write_error; + if (len > 0) { + if (fwrite(devpath, 1, len, udev_queue_export->queue_file) != len) + goto write_error; + } /* *must* flush output; caller may fork */ if (fflush(udev_queue_export->queue_file) != 0) @@ -324,7 +327,6 @@ write_error: enum device_state { DEVICE_QUEUED, DEVICE_FINISHED, - DEVICE_FAILED, }; static inline size_t queue_record_size(size_t devpath_len) @@ -341,6 +343,7 @@ static int update_queue(struct udev_queue_export *udev_queue_export, int bytes; int err; + /* FINISHED records have a zero length devpath */ if (state == DEVICE_QUEUED) { devpath = udev_device_get_devpath(udev_device); devpath_len = strlen(devpath); @@ -352,12 +355,9 @@ static int update_queue(struct udev_queue_export *udev_queue_export, return -1; } - /* when the queue file grows too large, garbage-collect and rebuild it */ - bytes = ftell(udev_queue_export->queue_file) + queue_record_size(devpath_len); - /* if we're removing the last event from the queue, that's the best time to rebuild it */ - if (state != DEVICE_QUEUED && udev_queue_export->queued_count == 1 && bytes > 2048) { - /* because we don't need to read the old queue file */ + if (state != DEVICE_QUEUED && udev_queue_export->queued_count == 1) { + /* we don't need to read the old queue file */ fclose(udev_queue_export->queue_file); udev_queue_export->queue_file = NULL; rebuild_queue_file(udev_queue_export); @@ -365,6 +365,7 @@ static int update_queue(struct udev_queue_export *udev_queue_export, } /* try to rebuild the queue files before they grow larger than one page. */ + bytes = ftell(udev_queue_export->queue_file) + queue_record_size(devpath_len); if ((udev_queue_export->waste_bytes > bytes / 2) && bytes > 4096) rebuild_queue_file(udev_queue_export); @@ -391,49 +392,9 @@ static int update_queue(struct udev_queue_export *udev_queue_export, return err; } -static void update_failed(struct udev_queue_export *udev_queue_export, - struct udev_device *udev_device, enum device_state state) -{ - struct udev *udev = udev_device_get_udev(udev_device); - char filename[UTIL_PATH_SIZE]; - - if (state != DEVICE_FAILED && udev_queue_export->failed_count == 0) - return; - - /* location of failed file */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/failed/", - udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); - - switch (state) { - case DEVICE_FAILED: - /* record event in the failed directory */ - udev_queue_export->failed_count++; - util_create_path(udev, filename); - udev_selinux_setfscreatecon(udev, filename, S_IFLNK); - symlink(udev_device_get_devpath(udev_device), filename); - udev_selinux_resetfscreatecon(udev); - break; - - case DEVICE_QUEUED: - /* delete failed file */ - if (unlink(filename) == 0) { - util_delete_path(udev, filename); - udev_queue_export->failed_count--; - } - break; - - case DEVICE_FINISHED: - break; - } - - return; -} - static int update(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device, enum device_state state) { - update_failed(udev_queue_export, udev_device, state); - if (update_queue(udev_queue_export, udev_device, state) != 0) return -1; @@ -449,8 +410,3 @@ int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_expor { return update(udev_queue_export, udev_device, DEVICE_FINISHED); } - -int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) -{ - return update(udev_queue_export, udev_device, DEVICE_FAILED); -} diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index 163e622..3d46b67 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -42,8 +42,7 @@ struct udev_queue { struct udev *udev; int refcount; - struct udev_list_node queue_list; - struct udev_list_node failed_list; + struct udev_list queue_list; }; /** @@ -55,7 +54,7 @@ struct udev_queue { * * Returns: the udev queue context, or #NULL on error. **/ -struct udev_queue *udev_queue_new(struct udev *udev) +UDEV_EXPORT struct udev_queue *udev_queue_new(struct udev *udev) { struct udev_queue *udev_queue; @@ -67,8 +66,7 @@ struct udev_queue *udev_queue_new(struct udev *udev) return NULL; udev_queue->refcount = 1; udev_queue->udev = udev; - udev_list_init(&udev_queue->queue_list); - udev_list_init(&udev_queue->failed_list); + udev_list_init(udev, &udev_queue->queue_list, false); return udev_queue; } @@ -80,7 +78,7 @@ struct udev_queue *udev_queue_new(struct udev *udev) * * Returns: the same udev queue context. **/ -struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue) +UDEV_EXPORT struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue) { if (udev_queue == NULL) return NULL; @@ -95,15 +93,14 @@ struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue) * Drop a reference of a udev queue context. If the refcount reaches zero, * the resources of the queue context will be released. **/ -void udev_queue_unref(struct udev_queue *udev_queue) +UDEV_EXPORT void udev_queue_unref(struct udev_queue *udev_queue) { if (udev_queue == NULL) return; udev_queue->refcount--; if (udev_queue->refcount > 0) return; - udev_list_cleanup_entries(udev_queue->udev, &udev_queue->queue_list); - udev_list_cleanup_entries(udev_queue->udev, &udev_queue->failed_list); + udev_list_cleanup(&udev_queue->queue_list); free(udev_queue); } @@ -115,7 +112,7 @@ void udev_queue_unref(struct udev_queue *udev_queue) * * Returns: the udev library context. **/ -struct udev *udev_queue_get_udev(struct udev_queue *udev_queue) +UDEV_EXPORT struct udev *udev_queue_get_udev(struct udev_queue *udev_queue) { if (udev_queue == NULL) return NULL; @@ -149,7 +146,7 @@ unsigned long long int udev_get_kernel_seqnum(struct udev *udev) * * Returns: the current kernel event sequence number. **/ -unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) +UDEV_EXPORT unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) { unsigned long long int seqnum; @@ -214,7 +211,7 @@ static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long i char filename[UTIL_PATH_SIZE]; FILE *queue_file; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue->udev), "/.udev/queue.bin", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue->udev), "/queue.bin", NULL); queue_file = fopen(filename, "re"); if (queue_file == NULL) return NULL; @@ -234,7 +231,7 @@ static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long i * * Returns: the last known udev event sequence number. **/ -unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) +UDEV_EXPORT unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) { unsigned long long int seqnum_udev; FILE *queue_file; @@ -266,7 +263,7 @@ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) * * Returns: a flag indicating if udev is active. **/ -int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) +UDEV_EXPORT int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) { unsigned long long int seqnum_start; FILE *queue_file; @@ -285,7 +282,7 @@ int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) * * Returns: a flag indicating if udev is currently handling events. **/ -int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) +UDEV_EXPORT int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) { unsigned long long int seqnum_kernel; unsigned long long int seqnum_udev = 0; @@ -343,9 +340,9 @@ out: * @start: first event sequence number * @end: last event sequence number * - * Returns: if any of the sequence numbers in the given range is currently active. + * Returns: a flag indicating if any of the sequence numbers in the given range is currently active. **/ -int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, +UDEV_EXPORT int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, unsigned long long int start, unsigned long long int end) { unsigned long long int seqnum; @@ -405,9 +402,9 @@ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, * @udev_queue: udev queue context * @seqnum: sequence number * - * Returns: a flag indicating if the given sequence number is handled. + * Returns: a flag indicating if the given sequence number is currently active. **/ -int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) +UDEV_EXPORT int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) { if (!udev_queue_get_seqnum_sequence_is_finished(udev_queue, seqnum, seqnum)) return 0; @@ -422,14 +419,14 @@ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned lo * * Returns: the first entry of the list of queued events. **/ -struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) +UDEV_EXPORT struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) { unsigned long long int seqnum; FILE *queue_file; if (udev_queue == NULL) return NULL; - udev_list_cleanup_entries(udev_queue->udev, &udev_queue->queue_list); + udev_list_cleanup(&udev_queue->queue_list); queue_file = open_queue_file(udev_queue, &seqnum); if (queue_file == NULL) @@ -454,7 +451,7 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev break; if (len > 0) { - udev_list_entry_add(udev_queue->udev, &udev_queue->queue_list, syspath, seqnum_str, 0, 0); + udev_list_entry_add(&udev_queue->queue_list, syspath, seqnum_str); } else { udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_queue->queue_list)) { if (strcmp(seqnum_str, udev_list_entry_get_value(list_entry)) == 0) { @@ -469,47 +466,9 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev return udev_list_get_entry(&udev_queue->queue_list); } -/** - * udev_queue_get_failed_list_entry: - * @udev_queue: udev queue context - * - * Returns: the first entry of the list of recorded failed events. - **/ -struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue) +struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue); +UDEV_EXPORT struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue) { - char path[UTIL_PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - if (udev_queue == NULL) - return NULL; - udev_list_cleanup_entries(udev_queue->udev, &udev_queue->failed_list); - util_strscpyl(path, sizeof(path), udev_get_dev_path(udev_queue->udev), "/.udev/failed", NULL); - dir = opendir(path); - if (dir == NULL) - return NULL; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char filename[UTIL_PATH_SIZE]; - char syspath[UTIL_PATH_SIZE]; - char *s; - size_t l; - ssize_t len; - struct stat statbuf; - - if (dent->d_name[0] == '.') - continue; - s = syspath; - l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL); - len = readlinkat(dirfd(dir), dent->d_name, s, l); - if (len <= 0 || (size_t)len == l) - continue; - s[len] = '\0'; - dbg(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name); - util_strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); - if (stat(filename, &statbuf) != 0) - continue; - udev_list_entry_add(udev_queue->udev, &udev_queue->failed_list, syspath, NULL, 0, 0); - } - closedir(dir); - return udev_list_get_entry(&udev_queue->failed_list); + errno = ENOSYS; + return NULL; } diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 6b68b6a..2d7f8dc 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -19,13 +19,12 @@ #include #include #include -#include #include #include "libudev.h" #include "libudev-private.h" -int util_create_path(struct udev *udev, const char *path) +static int create_path(struct udev *udev, const char *path, bool selinux) { char p[UTIL_PATH_SIZE]; char *pos; @@ -55,7 +54,8 @@ int util_create_path(struct udev *udev, const char *path) return err; dbg(udev, "mkdir '%s'\n", p); - udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755); + if (selinux) + udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755); err = mkdir(p, 0755); if (err != 0) { err = -errno; @@ -66,10 +66,21 @@ int util_create_path(struct udev *udev, const char *path) err = -ENOTDIR; } } - udev_selinux_resetfscreatecon(udev); + if (selinux) + udev_selinux_resetfscreatecon(udev); return err; } +int util_create_path(struct udev *udev, const char *path) +{ + return create_path(udev, path, false); +} + +int util_create_path_selinux(struct udev *udev, const char *path) +{ + return create_path(udev, path, true); +} + int util_delete_path(struct udev *udev, const char *path) { char p[UTIL_PATH_SIZE]; @@ -122,7 +133,7 @@ int util_unlink_secure(struct udev *udev, const char *filename) uid_t util_lookup_user(struct udev *udev, const char *user) { char *endptr; - int buflen = sysconf(_SC_GETPW_R_SIZE_MAX); + size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX); char buf[buflen]; struct passwd pwbuf; struct passwd *pw; @@ -147,7 +158,7 @@ uid_t util_lookup_user(struct udev *udev, const char *user) gid_t util_lookup_group(struct udev *udev, const char *group) { char *endptr; - int buflen = sysconf(_SC_GETGR_R_SIZE_MAX); + size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX); char *buf; struct group grbuf; struct group *gr; @@ -246,226 +257,3 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string, udev_device_unref(dev); return 0; } - -int util_run_program(struct udev *udev, const char *command, char **envp, - char *result, size_t ressize, size_t *reslen, - const sigset_t *sigmask, bool reset_prio) -{ - int status; - int outpipe[2] = {-1, -1}; - int errpipe[2] = {-1, -1}; - pid_t pid; - char arg[UTIL_PATH_SIZE]; - char program[UTIL_PATH_SIZE]; - char *argv[((sizeof(arg) + 1) / 2) + 1]; - int devnull; - int i; - int err = 0; - - info(udev, "'%s' started\n", command); - - /* build argv from command */ - util_strscpy(arg, sizeof(arg), command); - i = 0; - if (strchr(arg, ' ') != NULL) { - char *pos = arg; - - while (pos != NULL && pos[0] != '\0') { - if (pos[0] == '\'') { - /* do not separate quotes */ - pos++; - argv[i] = strsep(&pos, "\'"); - if (pos != NULL) - while (pos[0] == ' ') - pos++; - } else { - argv[i] = strsep(&pos, " "); - if (pos != NULL) - while (pos[0] == ' ') - pos++; - } - dbg(udev, "arg[%i] '%s'\n", i, argv[i]); - i++; - } - argv[i] = NULL; - } else { - argv[0] = arg; - argv[1] = NULL; - } - - /* prepare pipes from child to parent */ - if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { - if (pipe(outpipe) != 0) { - err(udev, "pipe failed: %m\n"); - return -1; - } - } - if (udev_get_log_priority(udev) >= LOG_INFO) { - if (pipe(errpipe) != 0) { - err(udev, "pipe failed: %m\n"); - return -1; - } - } - - /* allow programs in /lib/udev/ to be called without the path */ - if (argv[0][0] != '/') { - util_strscpyl(program, sizeof(program), LIBEXECDIR "/", argv[0], NULL); - argv[0] = program; - } - - pid = fork(); - switch(pid) { - case 0: - /* child closes parent ends of pipes */ - if (outpipe[READ_END] > 0) - close(outpipe[READ_END]); - if (errpipe[READ_END] > 0) - close(errpipe[READ_END]); - - /* discard child output or connect to pipe */ - devnull = open("/dev/null", O_RDWR); - if (devnull > 0) { - dup2(devnull, STDIN_FILENO); - if (outpipe[WRITE_END] < 0) - dup2(devnull, STDOUT_FILENO); - if (errpipe[WRITE_END] < 0) - dup2(devnull, STDERR_FILENO); - close(devnull); - } else - err(udev, "open /dev/null failed: %m\n"); - if (outpipe[WRITE_END] > 0) { - dup2(outpipe[WRITE_END], STDOUT_FILENO); - close(outpipe[WRITE_END]); - } - if (errpipe[WRITE_END] > 0) { - dup2(errpipe[WRITE_END], STDERR_FILENO); - close(errpipe[WRITE_END]); - } - - if (sigmask) - sigprocmask(SIG_SETMASK, sigmask, NULL); - if (reset_prio) - setpriority(PRIO_PROCESS, 0, 0); - - execve(argv[0], argv, envp); - if (errno == ENOENT || errno == ENOTDIR) { - /* may be on a filesystem which is not mounted right now */ - info(udev, "program '%s' not found\n", argv[0]); - } else { - /* other problems */ - err(udev, "exec of program '%s' failed\n", argv[0]); - } - _exit(1); - case -1: - err(udev, "fork of '%s' failed: %m\n", argv[0]); - return -1; - default: - /* read from child if requested */ - if (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { - ssize_t count; - size_t respos = 0; - - /* parent closes child ends of pipes */ - if (outpipe[WRITE_END] > 0) - close(outpipe[WRITE_END]); - if (errpipe[WRITE_END] > 0) - close(errpipe[WRITE_END]); - - /* read child output */ - while (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { - int fdcount; - fd_set readfds; - - FD_ZERO(&readfds); - if (outpipe[READ_END] > 0) - FD_SET(outpipe[READ_END], &readfds); - if (errpipe[READ_END] > 0) - FD_SET(errpipe[READ_END], &readfds); - fdcount = select(MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL); - if (fdcount < 0) { - if (errno == EINTR) - continue; - err = -1; - break; - } - - /* get stdout */ - if (outpipe[READ_END] > 0 && FD_ISSET(outpipe[READ_END], &readfds)) { - char inbuf[1024]; - char *pos; - char *line; - - count = read(outpipe[READ_END], inbuf, sizeof(inbuf)-1); - if (count <= 0) { - close(outpipe[READ_END]); - outpipe[READ_END] = -1; - if (count < 0) { - err(udev, "stdin read failed: %m\n"); - err = -1; - } - continue; - } - inbuf[count] = '\0'; - - /* store result for rule processing */ - if (result) { - if (respos + count < ressize) { - memcpy(&result[respos], inbuf, count); - respos += count; - } else { - err(udev, "ressize %ld too short\n", (long)ressize); - err = -1; - } - } - pos = inbuf; - while ((line = strsep(&pos, "\n"))) - if (pos || line[0] != '\0') - info(udev, "'%s' (stdout) '%s'\n", argv[0], line); - } - - /* get stderr */ - if (errpipe[READ_END] > 0 && FD_ISSET(errpipe[READ_END], &readfds)) { - char errbuf[1024]; - char *pos; - char *line; - - count = read(errpipe[READ_END], errbuf, sizeof(errbuf)-1); - if (count <= 0) { - close(errpipe[READ_END]); - errpipe[READ_END] = -1; - if (count < 0) - err(udev, "stderr read failed: %m\n"); - continue; - } - errbuf[count] = '\0'; - pos = errbuf; - while ((line = strsep(&pos, "\n"))) - if (pos || line[0] != '\0') - info(udev, "'%s' (stderr) '%s'\n", argv[0], line); - } - } - if (outpipe[READ_END] > 0) - close(outpipe[READ_END]); - if (errpipe[READ_END] > 0) - close(errpipe[READ_END]); - - /* return the child's stdout string */ - if (result) { - result[respos] = '\0'; - dbg(udev, "result='%s'\n", result); - if (reslen) - *reslen = respos; - } - } - waitpid(pid, &status, 0); - if (WIFEXITED(status)) { - info(udev, "'%s' returned with exitcode %i\n", command, WEXITSTATUS(status)); - if (WEXITSTATUS(status) != 0) - err = -1; - } else { - err(udev, "'%s' unexpected exit with status 0x%04x\n", command, status); - err = -1; - } - } - return err; -} diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c index 51dd017..e08349e 100644 --- a/libudev/libudev-util.c +++ b/libudev/libudev-util.c @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008-2009 Kay Sievers + * Copyright (C) 2008-2011 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,7 +24,12 @@ #include "libudev.h" #include "libudev-private.h" -static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size) +/** + * SECTION:libudev-util + * @short_description: utils + */ + +ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size) { char path[UTIL_PATH_SIZE]; char target[UTIL_PATH_SIZE]; @@ -44,16 +49,6 @@ static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *sy return util_strscpy(value, size, pos); } -ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size) -{ - return get_sys_link(udev, "subsystem", syspath, subsystem, size); -} - -ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size) -{ - return get_sys_link(udev, "driver", syspath, driver, size); -} - int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size) { char link_target[UTIL_PATH_SIZE]; @@ -352,7 +347,7 @@ static int utf8_encoded_valid_unichar(const char *str) return len; } -int udev_util_replace_whitespace(const char *str, char *to, size_t len) +int util_replace_whitespace(const char *str, char *to, size_t len) { size_t i, j; @@ -392,7 +387,7 @@ static int is_whitelisted(char c, const char *white) } /* allow chars in whitelist, plain ascii, hex-escaping and valid utf8 */ -int udev_util_replace_chars(char *str, const char *white) +int util_replace_chars(char *str, const char *white) { size_t i = 0; int replaced = 0; @@ -435,18 +430,18 @@ int udev_util_replace_chars(char *str, const char *white) } /** - * util_encode_string: + * udev_util_encode_string: * @str: input string to be encoded * @str_enc: output string to store the encoded input string * @len: maximum size of the output string, which may be * four times as long as the input string * * Encode all potentially unsafe characters of a string to the - * corresponding hex value prefixed by '\x'. + * corresponding 2 char hex value prefixed by '\x'. * * Returns: 0 if the entire string was copied, non-zero otherwise. **/ -int udev_util_encode_string(const char *str, char *str_enc, size_t len) +UDEV_EXPORT int udev_util_encode_string(const char *str, char *str_enc, size_t len) { size_t i, j; @@ -557,7 +552,7 @@ uint64_t util_string_bloom64(const char *str) #define USEC_PER_SEC 1000000ULL #define NSEC_PER_USEC 1000ULL -unsigned long long usec_monotonic(void) +unsigned long long now_usec(void) { struct timespec ts; diff --git a/libudev/libudev.c b/libudev/libudev.c index cd41870..165c369 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -43,7 +43,9 @@ struct udev { char *sys_path; char *dev_path; char *rules_path; - struct udev_list_node properties_list; + char *run_config_path; + char *run_path; + struct udev_list properties_list; int log_priority; }; @@ -75,7 +77,7 @@ static void log_stderr(struct udev *udev, * * Returns: stored userdata **/ -void *udev_get_userdata(struct udev *udev) +UDEV_EXPORT void *udev_get_userdata(struct udev *udev) { if (udev == NULL) return NULL; @@ -89,13 +91,21 @@ void *udev_get_userdata(struct udev *udev) * * Store custom @userdata in the library context. **/ -void udev_set_userdata(struct udev *udev, void *userdata) +UDEV_EXPORT void udev_set_userdata(struct udev *udev, void *userdata) { if (udev == NULL) return; udev->userdata = userdata; } +static char *set_value(char **s, const char *v) +{ + free(*s); + *s = strdup(v); + util_remove_trailing_chars(*s, '/'); + return *s; +} + /** * udev_new: * @@ -107,11 +117,11 @@ void udev_set_userdata(struct udev *udev, void *userdata) * * Returns: a new udev library context **/ -struct udev *udev_new(void) +UDEV_EXPORT struct udev *udev_new(void) { struct udev *udev; const char *env; - char *config_file; + char *config_file = NULL; FILE *f; udev = calloc(1, sizeof(struct udev)); @@ -120,32 +130,22 @@ struct udev *udev_new(void) udev->refcount = 1; udev->log_fn = log_stderr; udev->log_priority = LOG_ERR; - udev_list_init(&udev->properties_list); - udev->dev_path = strdup("/dev"); - udev->sys_path = strdup("/sys"); - config_file = strdup(SYSCONFDIR "/udev/udev.conf"); - if (udev->dev_path == NULL || - udev->sys_path == NULL || - config_file == NULL) - goto err; - - /* settings by environment and config file */ - env = getenv("SYSFS_PATH"); - if (env != NULL) { - free(udev->sys_path); - udev->sys_path = strdup(env); - util_remove_trailing_chars(udev->sys_path, '/'); - udev_add_property(udev, "SYSFS_PATH", udev->sys_path); - } + udev_list_init(udev, &udev->properties_list, true); + /* custom config file */ env = getenv("UDEV_CONFIG_FILE"); if (env != NULL) { - free(config_file); - config_file = strdup(env); - util_remove_trailing_chars(config_file, '/'); + if (set_value(&config_file, env) == NULL) + goto err; + udev_add_property(udev, "UDEV_CONFIG_FILE", config_file); } + + /* default config file */ + if (config_file == NULL) + config_file = strdup(SYSCONFDIR "/udev/udev.conf"); if (config_file == NULL) goto err; + f = fopen(config_file, "re"); if (f != NULL) { char line[UTIL_LINE_SIZE]; @@ -214,40 +214,57 @@ struct udev *udev_new(void) continue; } if (strcmp(key, "udev_root") == 0) { - free(udev->dev_path); - udev->dev_path = strdup(val); - util_remove_trailing_chars(udev->dev_path, '/'); + set_value(&udev->dev_path, val); + continue; + } + if (strcmp(key, "udev_run") == 0) { + set_value(&udev->run_config_path, val); continue; } if (strcmp(key, "udev_rules") == 0) { - free(udev->rules_path); - udev->rules_path = strdup(val); - util_remove_trailing_chars(udev->rules_path, '/'); + set_value(&udev->rules_path, val); continue; } } fclose(f); } + /* environment overwrites config */ + env = getenv("UDEV_LOG"); + if (env != NULL) + udev_set_log_priority(udev, util_log_priority(env)); + env = getenv("UDEV_ROOT"); if (env != NULL) { - free(udev->dev_path); - udev->dev_path = strdup(env); - util_remove_trailing_chars(udev->dev_path, '/'); + set_value(&udev->dev_path, env); udev_add_property(udev, "UDEV_ROOT", udev->dev_path); } - env = getenv("UDEV_LOG"); - if (env != NULL) - udev_set_log_priority(udev, util_log_priority(env)); + env = getenv("SYSFS_PATH"); + if (env != NULL) { + set_value(&udev->sys_path, env); + udev_add_property(udev, "SYSFS_PATH", udev->sys_path); + } + + /* set defaults */ + if (udev->dev_path == NULL) + if (set_value(&udev->dev_path, "/dev") == NULL) + goto err; + + if (udev->sys_path == NULL) + if (set_value(&udev->sys_path, "/sys") == NULL) + goto err; + + if (udev->run_config_path == NULL) + if (set_value(&udev->run_config_path, "/run/udev") == NULL) + goto err; - if (udev->dev_path == NULL || udev->sys_path == NULL) - goto err; dbg(udev, "context %p created\n", udev); dbg(udev, "log_priority=%d\n", udev->log_priority); dbg(udev, "config_file='%s'\n", config_file); dbg(udev, "dev_path='%s'\n", udev->dev_path); dbg(udev, "sys_path='%s'\n", udev->sys_path); + dbg(udev, "run_path='%s'\n", udev->run_config_path); if (udev->rules_path != NULL) dbg(udev, "rules_path='%s'\n", udev->rules_path); free(config_file); @@ -267,7 +284,7 @@ err: * * Returns: the passed udev library context **/ -struct udev *udev_ref(struct udev *udev) +UDEV_EXPORT struct udev *udev_ref(struct udev *udev) { if (udev == NULL) return NULL; @@ -283,17 +300,19 @@ struct udev *udev_ref(struct udev *udev) * reaches zero, the resources of the context will be released. * **/ -void udev_unref(struct udev *udev) +UDEV_EXPORT void udev_unref(struct udev *udev) { if (udev == NULL) return; udev->refcount--; if (udev->refcount > 0) return; - udev_list_cleanup_entries(udev, &udev->properties_list); + udev_list_cleanup(&udev->properties_list); free(udev->dev_path); free(udev->sys_path); free(udev->rules_path); + free(udev->run_path); + free(udev->run_config_path); dbg(udev, "context %p released\n", udev); free(udev); } @@ -308,7 +327,7 @@ void udev_unref(struct udev *udev) * into the users' logging functionality. * **/ -void udev_set_log_fn(struct udev *udev, +UDEV_EXPORT void udev_set_log_fn(struct udev *udev, void (*log_fn)(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args)) @@ -326,7 +345,7 @@ void udev_set_log_fn(struct udev *udev, * * Returns: the current logging priority **/ -int udev_get_log_priority(struct udev *udev) +UDEV_EXPORT int udev_get_log_priority(struct udev *udev) { return udev->log_priority; } @@ -339,7 +358,7 @@ int udev_get_log_priority(struct udev *udev) * Set the current logging priority. The value controls which messages * are logged. **/ -void udev_set_log_priority(struct udev *udev, int priority) +UDEV_EXPORT void udev_set_log_priority(struct udev *udev, int priority) { char num[32]; @@ -363,7 +382,7 @@ const char *udev_get_rules_path(struct udev *udev) * * Returns: the sys mount point **/ -const char *udev_get_sys_path(struct udev *udev) +UDEV_EXPORT const char *udev_get_sys_path(struct udev *udev) { if (udev == NULL) return NULL; @@ -380,13 +399,54 @@ const char *udev_get_sys_path(struct udev *udev) * * Returns: the device directory path **/ -const char *udev_get_dev_path(struct udev *udev) +UDEV_EXPORT const char *udev_get_dev_path(struct udev *udev) { if (udev == NULL) return NULL; return udev->dev_path; } +const char *udev_get_run_config_path(struct udev *udev) +{ + return udev->run_config_path; +} + +/** + * udev_get_run_path: + * @udev: udev library context + * + * Retrieve the udev runtime directory path. The default is "/run/udev". + * + * Returns: the runtime directory path + **/ +UDEV_EXPORT const char *udev_get_run_path(struct udev *udev) +{ + if (udev->run_path != NULL) + return udev->run_path; + + /* check if configured path exists */ + if (access(udev->run_config_path, F_OK) < 0) { + char filename[UTIL_PATH_SIZE]; + + /* fall back to /dev/.udev if that exists */ + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev", NULL); + if (access(filename, F_OK) >= 0) + if (set_value(&udev->run_path, filename) != NULL) + return udev->run_path; + } + + /* use default path */ + set_value(&udev->run_path, udev->run_config_path); + if (udev->run_path == NULL) + return udev->run_config_path; + return udev->run_path; +} + +const char *udev_set_run_path(struct udev *udev, const char *path) +{ + return set_value(&udev->run_path, path); +} + struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value) { if (value == NULL) { @@ -398,7 +458,7 @@ struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, co udev_list_entry_delete(list_entry); return NULL; } - return udev_list_entry_add(udev, &udev->properties_list, key, value, 1, 0); + return udev_list_entry_add(&udev->properties_list, key, value); } struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev) diff --git a/libudev/libudev.h b/libudev/libudev.h index 0abd7c8..497f752 100644 --- a/libudev/libudev.h +++ b/libudev/libudev.h @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008-2010 Kay Sievers + * Copyright (C) 2008-2011 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -38,6 +38,7 @@ int udev_get_log_priority(struct udev *udev); void udev_set_log_priority(struct udev *udev, int priority); const char *udev_get_sys_path(struct udev *udev); const char *udev_get_dev_path(struct udev *udev); +const char *udev_get_run_path(struct udev *udev); void *udev_get_userdata(struct udev *udev); void udev_set_userdata(struct udev *udev, void *userdata); @@ -92,6 +93,7 @@ int udev_device_get_is_initialized(struct udev_device *udev_device); struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device); struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device); struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device); +struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device); const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key); const char *udev_device_get_driver(struct udev_device *udev_device); dev_t udev_device_get_devnum(struct udev_device *udev_device); @@ -99,6 +101,7 @@ const char *udev_device_get_action(struct udev_device *udev_device); unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device); unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device); const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr); +int udev_device_has_tag(struct udev_device *udev_device, const char *tag); /* * udev_monitor @@ -143,6 +146,7 @@ int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, co int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value); int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname); int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag); +int udev_enumerate_add_match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *parent); int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate); int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath); /* run enumeration with active filters */ @@ -169,7 +173,14 @@ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned lo int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, unsigned long long int start, unsigned long long int end); struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue); -struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue); + +/* + * udev_util + * + * udev specific utilities + */ +int udev_util_encode_string(const char *str, char *str_enc, size_t len); + #ifdef __cplusplus } /* extern "C" */ diff --git a/libudev/test-libudev.c b/libudev/test-libudev.c index f8eb8e5..c325f8e 100644 --- a/libudev/test-libudev.c +++ b/libudev/test-libudev.c @@ -18,10 +18,12 @@ #include #include #include -#include +#include #include "libudev.h" +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + static void log_fn(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args) @@ -219,56 +221,80 @@ static int test_enumerate_print_list(struct udev_enumerate *enumerate) static int test_monitor(struct udev *udev) { - struct udev_monitor *udev_monitor; - fd_set readfds; - int fd; + struct udev_monitor *udev_monitor = NULL; + int fd_ep; + int fd_udev = -1; + struct epoll_event ep_udev, ep_stdin; + + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + printf("error creating epoll fd: %m\n"); + goto out; + } udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); if (udev_monitor == NULL) { printf("no socket\n"); - return -1; + goto out; } + fd_udev = udev_monitor_get_fd(udev_monitor); + if (udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "block", NULL) < 0 || udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL) < 0 || udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "usb", "usb_device") < 0) { printf("filter failed\n"); - return -1; + goto out; } + if (udev_monitor_enable_receiving(udev_monitor) < 0) { printf("bind failed\n"); - return -1; + goto out; } - fd = udev_monitor_get_fd(udev_monitor); - FD_ZERO(&readfds); + memset(&ep_udev, 0, sizeof(struct epoll_event)); + ep_udev.events = EPOLLIN; + ep_udev.data.fd = fd_udev; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_udev, &ep_udev) < 0) { + printf("fail to add fd to epoll: %m\n"); + goto out; + } + + memset(&ep_stdin, 0, sizeof(struct epoll_event)); + ep_stdin.events = EPOLLIN; + ep_stdin.data.fd = STDIN_FILENO; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, STDIN_FILENO, &ep_stdin) < 0) { + printf("fail to add fd to epoll: %m\n"); + goto out; + } for (;;) { - struct udev_device *device; int fdcount; - - FD_SET(STDIN_FILENO, &readfds); - FD_SET(fd, &readfds); + struct epoll_event ev[4]; + struct udev_device *device; + int i; printf("waiting for events from udev, press ENTER to exit\n"); - fdcount = select(fd+1, &readfds, NULL, NULL, NULL); - printf("select fd count: %i\n", fdcount); - - if (FD_ISSET(fd, &readfds)) { - device = udev_monitor_receive_device(udev_monitor); - if (device == NULL) { - printf("no device from socket\n"); - continue; + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); + printf("epoll fd count: %i\n", fdcount); + + for (i = 0; i < fdcount; i++) { + if (ev[i].data.fd == fd_udev && ev[i].events & EPOLLIN) { + device = udev_monitor_receive_device(udev_monitor); + if (device == NULL) { + printf("no device from socket\n"); + continue; + } + print_device(device); + udev_device_unref(device); + } else if (ev[i].data.fd == STDIN_FILENO && ev[i].events & EPOLLIN) { + printf("exiting loop\n"); + goto out; } - print_device(device); - udev_device_unref(device); - } - - if (FD_ISSET(STDIN_FILENO, &readfds)) { - printf("exiting loop\n"); - break; } } - +out: + if (fd_ep >= 0) + close(fd_ep); udev_monitor_unref(udev_monitor); return 0; } @@ -297,10 +323,6 @@ static int test_queue(struct udev *udev) udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); printf("\n"); - printf("get failed list\n"); - udev_list_entry_foreach(list_entry, udev_queue_get_failed_list_entry(udev_queue)) - printf("failed: '%s'\n", udev_list_entry_get_name(list_entry)); - printf("\n"); list_entry = udev_queue_get_queued_list_entry(udev_queue); if (list_entry != NULL) { @@ -426,7 +448,7 @@ int main(int argc, char *argv[]) for (;;) { int option; - option = getopt_long(argc, argv, "+dhV", options, NULL); + option = getopt_long(argc, argv, "+p:s:dhV", options, NULL); if (option == -1) break; diff --git a/m4/gtk-doc.m4 b/m4/gtk-doc.m4 index 2cfa1e7..0ada151 100644 --- a/m4/gtk-doc.m4 +++ b/m4/gtk-doc.m4 @@ -6,6 +6,7 @@ dnl Usage: dnl GTK_DOC_CHECK([minimum-gtk-doc-version]) AC_DEFUN([GTK_DOC_CHECK], [ + AC_REQUIRE([PKG_PROG_PKG_CONFIG]) AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first @@ -33,6 +34,11 @@ AC_DEFUN([GTK_DOC_CHECK], AC_MSG_ERROR([gtk-doc not installed and --enable-gtk-doc requested]))], [PKG_CHECK_EXISTS([gtk-doc >= $1],, AC_MSG_ERROR([You need to have gtk-doc >= $1 installed to build $PACKAGE_NAME]))]) + dnl don't check for glib if we build glib + if test "x$PACKAGE_NAME" != "xglib"; then + dnl don't fail if someone does not have glib + PKG_CHECK_MODULES(GTKDOC_DEPS, glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0,,) + fi fi AC_MSG_CHECKING([whether to build gtk-doc documentation]) diff --git a/m4/libtool.m4 b/m4/libtool.m4 index b1251be..88de383 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -1,7 +1,8 @@ # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. +# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, +# Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives @@ -10,7 +11,8 @@ m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. +# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, +# Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. @@ -37,7 +39,7 @@ m4_define([_LT_COPYING], [dnl # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) -# serial 56 LT_INIT +# serial 57 LT_INIT # LT_PREREQ(VERSION) @@ -66,6 +68,7 @@ esac # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl @@ -82,6 +85,8 @@ AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) @@ -118,7 +123,7 @@ m4_defun([_LT_CC_BASENAME], *) break;; esac done -cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) @@ -138,6 +143,9 @@ m4_defun([_LT_FILEUTILS_DEFAULTS], m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl @@ -160,10 +168,13 @@ _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our @@ -179,7 +190,6 @@ fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl -_LT_PROG_ECHO_BACKSLASH case $host_os in aix3*) @@ -193,23 +203,6 @@ aix3*) ;; esac -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([["`\\]]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - # Global variables: ofile=libtool can_build_shared=yes @@ -250,6 +243,28 @@ _LT_CONFIG_COMMANDS ])# _LT_SETUP +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' @@ -408,7 +423,7 @@ m4_define([_lt_decl_all_varnames], # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], -[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`']) +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS @@ -418,7 +433,7 @@ m4_define([_LT_CONFIG_STATUS_DECLARE], # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # -# ='`$ECHO "X$" | $Xsed -e "$delay_single_quote_subst"`' +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) @@ -517,12 +532,20 @@ LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -533,9 +556,9 @@ done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -543,16 +566,38 @@ for var in lt_decl_all_varnames([[ \ esac done -# Fix-up fallback echo if it was mangled by the above quoting rules. -case \$lt_ECHO in -*'\\\[$]0 --fallback-echo"')dnl " - lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` - ;; -esac - _LT_OUTPUT_LIBTOOL_INIT ]) +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# `#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test $lt_write_fail = 0 && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- @@ -562,20 +607,11 @@ _LT_OUTPUT_LIBTOOL_INIT AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) -cat >"$CONFIG_LT" <<_LTEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate a libtool stub with the current configuration. - -lt_cl_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_LTEOF +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF -AS_SHELL_SANITIZE -_AS_PREPARE - -exec AS_MESSAGE_FD>&1 +lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo @@ -601,7 +637,7 @@ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. -Copyright (C) 2008 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." @@ -646,15 +682,13 @@ chmod +x "$CONFIG_LT" # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. -if test "$no_create" != yes; then - lt_cl_success=: - test "$silent" = yes && - lt_config_lt_args="$lt_config_lt_args --quiet" - exec AS_MESSAGE_LOG_FD>/dev/null - $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false - exec AS_MESSAGE_LOG_FD>>config.log - $lt_cl_success || AS_EXIT(1) -fi +lt_cl_success=: +test "$silent" = yes && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT @@ -684,6 +718,7 @@ _LT_CONFIG_SAVE_COMMANDS([ # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING @@ -716,15 +751,12 @@ _LT_EOF # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? - sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) - _LT_PROG_XSI_SHELLFNS + _LT_PROG_REPLACE_SHELLFNS - sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || + mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], @@ -830,11 +862,13 @@ AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER @@ -939,6 +973,31 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; @@ -966,7 +1025,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi - if test "$DSYMUTIL" != ":"; then + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= @@ -986,7 +1045,11 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(whole_archive_flag_spec, $1)='' + if test "$lt_cv_ld_force_load" = "yes"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in @@ -994,7 +1057,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=echo + output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" @@ -1010,203 +1073,142 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], fi ]) -# _LT_SYS_MODULE_PATH_AIX -# ----------------------- +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl -AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_SHELL_INIT +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + # _LT_PROG_ECHO_BACKSLASH # ----------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script which will find a shell with a builtin +# printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], -[_LT_SHELL_INIT([ -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$lt_ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; -esac - -ECHO=${lt_ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then - # Yippee, $ECHO works! - : +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' else - # Restart under the correct shell. - exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} -fi - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<_LT_EOF -[$]* -_LT_EOF - exit 0 + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' fi -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test -z "$lt_ECHO"; then - if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if { echo_test_string=`eval $cmd`; } 2>/dev/null && - { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null - then - break - fi - done - fi - - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : - else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$ECHO" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - ECHO='print -r' - elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - ECHO='printf %s\n' - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - ECHO="$CONFIG_SHELL [$]0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do - if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null - then - break - fi - prev="$cmd" - done +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} - if test "$prev" != 'sed 50q "[$]0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - ECHO=echo - fi - fi - fi - fi - fi -fi +case "$ECHO" in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; +esac -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -lt_ECHO=$ECHO -if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) -AC_SUBST(lt_ECHO) -]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) -_LT_DECL([], [ECHO], [1], - [An echo program that does not interpret backslashes]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[ --with-sysroot[=DIR] Search for dependent libraries within DIR + (or the compiler's sysroot if not specified).], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([${with_sysroot}]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and in which our libraries should be installed.])]) + # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], @@ -1235,7 +1237,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in @@ -1353,14 +1355,47 @@ need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], -[AC_CHECK_TOOL(AR, ar, false) -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1]) +[_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: @@ -1387,10 +1422,19 @@ if test -n "$RANLIB"; then esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE @@ -1415,15 +1459,15 @@ AC_CACHE_CHECK([$1], [$2], -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes @@ -1463,7 +1507,7 @@ AC_CACHE_CHECK([$1], [$2], if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD - $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes @@ -1526,6 +1570,11 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl lt_cv_sys_max_cmd_len=8192; ;; + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. @@ -1590,8 +1639,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ - = "XX$teststring$teststring"; } >/dev/null 2>&1 && + while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` @@ -1642,7 +1691,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -[#line __oline__ "configure" +[#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -1683,7 +1732,13 @@ else # endif #endif -void fnord() { int i=42;} +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -1692,7 +1747,11 @@ int main () if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } /* dlclose (self); */ } else @@ -1868,16 +1927,16 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes @@ -2036,6 +2095,7 @@ m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ @@ -2044,16 +2104,23 @@ if test "$GCC" = yes; then darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` - else - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= @@ -2066,7 +2133,7 @@ if test "$GCC" = yes; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done - lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; @@ -2086,7 +2153,13 @@ BEGIN {RS=" "; FS="/|\n";} { if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` - sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) @@ -2174,7 +2247,7 @@ amigaos*) m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; @@ -2205,8 +2278,9 @@ cygwin* | mingw* | pw32* | cegcc*) need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + case $GCC,$cc_basename in + yes,*) + # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ @@ -2227,36 +2301,83 @@ cygwin* | mingw* | pw32* | cegcc*) cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' ;; *) + # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' ;; esac - dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; @@ -2343,6 +2464,19 @@ gnu*) hardcode_into_libs=yes ;; +haiku*) + version_type=linux + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. @@ -2385,8 +2519,10 @@ hpux9* | hpux10* | hpux11*) soname_spec='${libname}${release}${shared_ext}$major' ;; esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 ;; interix[[3-9]]*) @@ -2444,7 +2580,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be Linux ELF. -linux* | k*bsd*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no @@ -2453,26 +2589,35 @@ linux* | k*bsd*-gnu) finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ - LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], - [shlibpath_overrides_runpath=yes])]) - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -2704,6 +2849,8 @@ _LT_DECL([], [library_names_spec], [1], The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], @@ -2816,6 +2963,7 @@ AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], @@ -2937,6 +3085,11 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' @@ -2945,8 +3098,8 @@ case $host_os in fi ;; esac -_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl -_LT_DECL([], [reload_cmds], [2])dnl +_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl +_LT_TAGDECL([], [reload_cmds], [2])dnl ])# _LT_CMD_RELOAD @@ -2998,16 +3151,18 @@ mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; -cegcc) +cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' @@ -3037,6 +3192,10 @@ gnu*) lt_cv_deplibs_check_method=pass_all ;; +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in @@ -3045,11 +3204,11 @@ hpux10.20* | hpux11*) lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac @@ -3071,7 +3230,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be Linux ELF. -linux* | k*bsd*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; @@ -3149,6 +3308,21 @@ tpf*) ;; esac ]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown @@ -3156,7 +3330,11 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method == "file_magic"]) + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD @@ -3213,7 +3391,19 @@ if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. - AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" @@ -3226,13 +3416,13 @@ _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -3247,6 +3437,67 @@ dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + # LT_LIB_M # -------- @@ -3255,7 +3506,7 @@ AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) @@ -3283,7 +3534,12 @@ m4_defun([_LT_COMPILER_NO_RTTI], _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, @@ -3300,6 +3556,7 @@ _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl @@ -3367,8 +3624,8 @@ esac lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= @@ -3404,6 +3661,7 @@ for ac_symprfx in "" "_"; do else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no @@ -3425,7 +3683,7 @@ _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -3437,6 +3695,18 @@ _LT_EOF if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t@_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT@&t@_DLSYM_CONST +#else +# define LT@&t@_DLSYM_CONST const +#endif + #ifdef __cplusplus extern "C" { #endif @@ -3448,7 +3718,7 @@ _LT_EOF cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ -const struct { +LT@&t@_DLSYM_CONST struct { const char *name; void *address; } @@ -3474,15 +3744,15 @@ static const void *lt_preloaded_setup() { _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi @@ -3515,6 +3785,13 @@ else AC_MSG_RESULT(ok) fi +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], @@ -3525,6 +3802,8 @@ _LT_DECL([global_symbol_to_c_name_address], _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS @@ -3536,7 +3815,6 @@ _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= -AC_MSG_CHECKING([for $compiler option to produce PIC]) m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then @@ -3587,6 +3865,11 @@ m4_if([$1], [CXX], [ # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. @@ -3636,6 +3919,12 @@ m4_if([$1], [CXX], [ ;; esac ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; dgux*) case $cc_basename in ec++*) @@ -3692,7 +3981,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler @@ -3725,8 +4014,8 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - xlc* | xlC*) - # IBM XL 8.0 on PPC + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' @@ -3788,7 +4077,7 @@ m4_if([$1], [CXX], [ ;; solaris*) case $cc_basename in - CC*) + CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' @@ -3892,6 +4181,12 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag @@ -3934,6 +4229,13 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC' + ;; + esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in @@ -3976,7 +4278,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -3997,7 +4299,13 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; - pgcc* | pgf77* | pgf90* | pgf95*) + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4009,25 +4317,25 @@ m4_if([$1], [CXX], [ # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - xl*) - # IBM XL C 8.0/Fortran 10.1 on PPC + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C 5.9 + *Sun\ F* | *Sun*Fortran*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; - *Sun\ F*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker + *Sun\ C*) + # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; esac ;; @@ -4059,7 +4367,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in - f77* | f90* | f95*) + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; @@ -4116,9 +4424,11 @@ case $host_os in _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac -AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. @@ -4137,6 +4447,8 @@ fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # @@ -4157,6 +4469,7 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl @@ -4165,27 +4478,35 @@ m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global defined + # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; + ;; cygwin* | mingw* | cegcc*) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - ;; + case $cc_basename in + cl*) ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; + ;; esac - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= @@ -4248,7 +4569,33 @@ dnl Note also adjust exclude_expsyms for C++ above. esac _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' @@ -4266,6 +4613,7 @@ dnl Note also adjust exclude_expsyms for C++ above. fi supports_anon_versioning=no case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... @@ -4281,11 +4629,12 @@ dnl Note also adjust exclude_expsyms for C++ above. _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 -*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. _LT_EOF fi @@ -4321,10 +4670,12 @@ _LT_EOF # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' @@ -4342,6 +4693,11 @@ _LT_EOF fi ;; + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no @@ -4357,7 +4713,7 @@ _LT_EOF _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; - gnu* | linux* | tpf* | k*bsd*-gnu) + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in @@ -4367,15 +4723,16 @@ _LT_EOF if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then - tmp_addflag= + tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -4386,13 +4743,17 @@ _LT_EOF lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; - xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 @@ -4408,17 +4769,17 @@ _LT_EOF fi case $cc_basename in - xlf*) + xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac @@ -4432,8 +4793,8 @@ _LT_EOF _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; @@ -4451,8 +4812,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -4498,8 +4859,8 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -4539,8 +4900,10 @@ _LT_EOF else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi @@ -4627,9 +4990,9 @@ _LT_EOF _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' @@ -4638,14 +5001,19 @@ _LT_EOF else # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' @@ -4677,20 +5045,63 @@ _LT_EOF # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac ;; darwin* | rhapsody*) @@ -4728,7 +5139,7 @@ _LT_EOF # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no @@ -4736,7 +5147,7 @@ _LT_EOF hpux9*) if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi @@ -4751,8 +5162,8 @@ _LT_EOF ;; hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi @@ -4770,16 +5181,16 @@ _LT_EOF ;; hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then + if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else @@ -4791,7 +5202,14 @@ _LT_EOF _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi @@ -4819,19 +5237,34 @@ _LT_EOF irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - AC_LINK_IFELSE(int foo(void) {}, - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - ) - LDFLAGS="$save_LDFLAGS" + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS="$save_LDFLAGS"]) + if test "$lt_cv_irix_exported_symbol" = yes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' @@ -4893,17 +5326,17 @@ _LT_EOF _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' @@ -4913,13 +5346,13 @@ _LT_EOF osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -4932,9 +5365,9 @@ _LT_EOF _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) @@ -5110,36 +5543,38 @@ x|xyes) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) - _LT_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) - then - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)]) + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi @@ -5204,8 +5639,6 @@ _LT_TAGDECL([], [inherit_rpath], [0], to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [fix_srcfile_path], [1], - [Fix the shell variable $srcfile for the compiler]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], @@ -5216,6 +5649,8 @@ _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented @@ -5309,37 +5744,22 @@ CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG -# _LT_PROG_CXX -# ------------ -# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ -# compiler, we have our own version here. -m4_defun([_LT_PROG_CXX], -[ -pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) -AC_PROG_CXX -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_PROG_CXXCPP -else - _lt_caught_CXX_error=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_CXX - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_CXX], []) - - # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], -[AC_REQUIRE([_LT_PROG_CXX])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no @@ -5361,6 +5781,8 @@ _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no @@ -5392,6 +5814,7 @@ if test "$_lt_caught_CXX_error" != yes; then # Allow CC to be a program name with arguments. lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX @@ -5409,6 +5832,7 @@ if test "$_lt_caught_CXX_error" != yes; then fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -5430,8 +5854,8 @@ if test "$_lt_caught_CXX_error" != yes; then # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' @@ -5463,7 +5887,7 @@ if test "$_lt_caught_CXX_error" != yes; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no @@ -5572,10 +5996,10 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' @@ -5584,14 +6008,19 @@ if test "$_lt_caught_CXX_error" != yes; then else # Determine the default libpath from the value encoded in an # empty executable. - _LT_SYS_MODULE_PATH_AIX + _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. @@ -5621,28 +6050,75 @@ if test "$_lt_caught_CXX_error" != yes; then ;; cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; @@ -5684,6 +6160,11 @@ if test "$_lt_caught_CXX_error" != yes; then gnu*) ;; + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: @@ -5708,11 +6189,11 @@ if test "$_lt_caught_CXX_error" != yes; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no @@ -5773,7 +6254,7 @@ if test "$_lt_caught_CXX_error" != yes; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then @@ -5783,10 +6264,10 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi @@ -5816,7 +6297,7 @@ if test "$_lt_caught_CXX_error" != yes; then case $cc_basename in CC*) # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -5827,9 +6308,9 @@ if test "$_lt_caught_CXX_error" != yes; then *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes @@ -5840,7 +6321,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(inherit_rpath, $1)=yes ;; - linux* | k*bsd*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler @@ -5858,7 +6339,7 @@ if test "$_lt_caught_CXX_error" != yes; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' @@ -5895,26 +6376,26 @@ if test "$_lt_caught_CXX_error" != yes; then pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in - *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*) + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; - *) # Version 6 will use weak symbols + *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; @@ -5922,7 +6403,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ @@ -5941,9 +6422,9 @@ if test "$_lt_caught_CXX_error" != yes; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; - xl*) + xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' @@ -5963,13 +6444,13 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. - output_verbose_link_cmd='echo' + output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is @@ -6038,7 +6519,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi - output_verbose_link_cmd=echo + output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -6073,15 +6554,15 @@ if test "$_lt_caught_CXX_error" != yes; then case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; @@ -6097,17 +6578,17 @@ if test "$_lt_caught_CXX_error" != yes; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac @@ -6117,7 +6598,7 @@ if test "$_lt_caught_CXX_error" != yes; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support @@ -6153,7 +6634,7 @@ if test "$_lt_caught_CXX_error" != yes; then solaris*) case $cc_basename in - CC*) + CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' @@ -6174,7 +6655,7 @@ if test "$_lt_caught_CXX_error" != yes; then esac _LT_TAGVAR(link_all_deplibs, $1)=yes - output_verbose_link_cmd='echo' + output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is @@ -6194,14 +6675,14 @@ if test "$_lt_caught_CXX_error" != yes; then if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. @@ -6212,7 +6693,7 @@ if test "$_lt_caught_CXX_error" != yes; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' @@ -6266,6 +6747,10 @@ if test "$_lt_caught_CXX_error" != yes; then CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' @@ -6321,6 +6806,7 @@ if test "$_lt_caught_CXX_error" != yes; then fi # test -n "$compiler" CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC @@ -6335,6 +6821,29 @@ AC_LANG_POP ])# _LT_LANG_CXX_CONFIG +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose @@ -6343,6 +6852,7 @@ AC_LANG_POP # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= @@ -6393,6 +6903,13 @@ public class foo { }; _LT_EOF ]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +esac + dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then @@ -6404,7 +6921,7 @@ if AC_TRY_EVAL(ac_compile); then pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do - case $p in + case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. @@ -6413,13 +6930,22 @@ if AC_TRY_EVAL(ac_compile); then test $p = "-R"; then prev=$p continue - else - prev= fi + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) + case ${prev} in + -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. @@ -6439,8 +6965,10 @@ if AC_TRY_EVAL(ac_compile); then _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi + prev= ;; + *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. @@ -6476,6 +7004,7 @@ else fi $RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], @@ -6512,7 +7041,7 @@ linux*) solaris*) case $cc_basename in - CC*) + CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as @@ -6556,32 +7085,16 @@ _LT_TAGDECL([], [compiler_lib_search_path], [1], ])# _LT_SYS_HIDDEN_LIBDEPS -# _LT_PROG_F77 -# ------------ -# Since AC_PROG_F77 is broken, in that it returns the empty string -# if there is no fortran compiler, we have our own version here. -m4_defun([_LT_PROG_F77], -[ -pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) -AC_PROG_F77 -if test -z "$F77" || test "X$F77" = "Xno"; then - _lt_disable_F77=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_F77 - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_F77], []) - - # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], -[AC_REQUIRE([_LT_PROG_F77])dnl -AC_LANG_PUSH(Fortran 77) +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test "X$F77" = "Xno"; then + _lt_disable_F77=yes +fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= @@ -6600,6 +7113,8 @@ _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no @@ -6639,7 +7154,9 @@ if test "$_lt_disable_F77" != yes; then # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} + CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -6693,38 +7210,24 @@ if test "$_lt_disable_F77" != yes; then GCC=$lt_save_GCC CC="$lt_save_CC" + CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG -# _LT_PROG_FC -# ----------- -# Since AC_PROG_FC is broken, in that it returns the empty string -# if there is no fortran compiler, we have our own version here. -m4_defun([_LT_PROG_FC], -[ -pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) -AC_PROG_FC -if test -z "$FC" || test "X$FC" = "Xno"; then - _lt_disable_FC=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_FC - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_FC], []) - - # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], -[AC_REQUIRE([_LT_PROG_FC])dnl -AC_LANG_PUSH(Fortran) +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test "X$FC" = "Xno"; then + _lt_disable_FC=yes +fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= @@ -6743,6 +7246,8 @@ _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no @@ -6782,7 +7287,9 @@ if test "$_lt_disable_FC" != yes; then # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} + CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu @@ -6838,7 +7345,8 @@ if test "$_lt_disable_FC" != yes; then fi # test -n "$compiler" GCC=$lt_save_GCC - CC="$lt_save_CC" + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP @@ -6875,10 +7383,12 @@ _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. -lt_save_CC="$CC" +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" @@ -6888,6 +7398,8 @@ _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change @@ -6907,7 +7419,8 @@ fi AC_LANG_RESTORE GCC=$lt_save_GCC -CC="$lt_save_CC" +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG @@ -6942,9 +7455,11 @@ _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" +lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} +CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) @@ -6957,7 +7472,8 @@ fi GCC=$lt_save_GCC AC_LANG_RESTORE -CC="$lt_save_CC" +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG @@ -7016,6 +7532,15 @@ _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) # _LT_DECL_SED # ------------ @@ -7109,8 +7634,8 @@ m4_defun([_LT_CHECK_SHELL_FEATURES], # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,, \ + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes @@ -7149,208 +7674,162 @@ _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES -# _LT_PROG_XSI_SHELLFNS -# --------------------- -# Bourne and XSI compatible variants of some useful shell functions. -m4_defun([_LT_PROG_XSI_SHELLFNS], -[case $xsi_shell in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=${1%%=*} - func_opt_split_arg=${1#*=} -} - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $[*] )) -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} +# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) +# ------------------------------------------------------ +# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and +# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. +m4_defun([_LT_PROG_FUNCTION_REPLACE], +[dnl { +sed -e '/^$1 ()$/,/^} # $1 /c\ +$1 ()\ +{\ +m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) +} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: +]) -_LT_EOF - ;; - *) # Bourne compatible functions. - cat << \_LT_EOF >> "$cfgfile" -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} +# _LT_PROG_REPLACE_SHELLFNS +# ------------------------- +# Replace existing portable implementations of several shell functions with +# equivalent extended shell implementations where those features are available.. +m4_defun([_LT_PROG_REPLACE_SHELLFNS], +[if test x"$xsi_shell" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}"]) -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` -} + _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"}]) -dnl func_dirname_and_basename -dnl A portable version of this function is already defined in general.m4sh -dnl so there is no need for it here. + _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl + func_split_long_opt_name=${1%%=*} + func_split_long_opt_arg=${1#*=}]) -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; - esac -} + _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) -# sed scripts: -my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' -my_sed_long_arg='1s/^-[[^=]]*=//' + _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac]) -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` -} + _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` -} + _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` -} + _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) +fi -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "$[@]"` -} +if test x"$lt_shell_append" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` -} + _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl + func_quote_for_eval "${2}" +dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ + eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) -_LT_EOF -esac + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi -case $lt_shell_append in - yes) - cat << \_LT_EOF >> "$cfgfile" +if test x"$_lt_function_replace_fail" = x":"; then + AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) +fi +]) -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]+=\$[2]" -} -_LT_EOF +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine which file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac ;; - *) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]=\$$[1]\$[2]" -} - -_LT_EOF + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac ;; - esac + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac ]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4 index 34151a3..17cfd51 100644 --- a/m4/ltoptions.m4 +++ b/m4/ltoptions.m4 @@ -1,13 +1,14 @@ # Helper functions for option handling. -*- Autoconf -*- # -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, +# Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 6 ltoptions.m4 +# serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) @@ -125,7 +126,7 @@ LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) @@ -133,13 +134,13 @@ case $host in esac test -z "$AS" && AS=as -_LT_DECL([], [AS], [0], [Assembler program])dnl +_LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], diff --git a/m4/ltversion.m4 b/m4/ltversion.m4 index f3c5309..9c7b5d4 100644 --- a/m4/ltversion.m4 +++ b/m4/ltversion.m4 @@ -7,17 +7,17 @@ # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# Generated from ltversion.in. +# @configure_input@ -# serial 3017 ltversion.m4 +# serial 3293 ltversion.m4 # This file is part of GNU Libtool -m4_define([LT_PACKAGE_VERSION], [2.2.6b]) -m4_define([LT_PACKAGE_REVISION], [1.3017]) +m4_define([LT_PACKAGE_VERSION], [2.4]) +m4_define([LT_PACKAGE_REVISION], [1.3293]) AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.2.6b' -macro_revision='1.3017' +[macro_version='2.4' +macro_revision='1.3293' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4 index 637bb20..c573da9 100644 --- a/m4/lt~obsolete.m4 +++ b/m4/lt~obsolete.m4 @@ -1,13 +1,13 @@ # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # -# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 4 lt~obsolete.m4 +# serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # @@ -77,7 +77,6 @@ m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) @@ -90,3 +89,10 @@ m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/packaging/start_udev b/packaging/start_udev old mode 100644 new mode 100755 diff --git a/packaging/udev-80-drivers.patch b/packaging/udev-80-drivers.patch new file mode 100755 index 0000000..a719163 --- /dev/null +++ b/packaging/udev-80-drivers.patch @@ -0,0 +1,61 @@ +--- udev/rules/debian/80-drivers.rules 1970-01-01 09:00:00.000000000 +0900 ++++ udev-174/rules/debian/80-drivers.rules 2012-07-30 17:13:38.353317439 +0900 +@@ -0,0 +1,58 @@ ++ACTION=="remove", GOTO="drivers_end" ++ ++# check if the device has already been claimed by a driver ++ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_driver_loaded" ++ ++# load the drivers ++ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe -b $env{MODALIAS}" ++ ++# workaround for kernels < 2.6.27-rc5 ++SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", \ ++ RUN+="/bin/sh -c '/sbin/modprobe --use-blacklist --all $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" ++ ++SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/modprobe -b pcmcia" ++ ++# rules for subsystems which lack proper hotplug support ++SUBSYSTEM=="i2o", RUN+="/sbin/modprobe -b i2o_block" ++# workaround for kernels < 2.6.30 ++SUBSYSTEM=="mmc", RUN+="/sbin/modprobe -b mmc_block" ++SUBSYSTEM=="memstick", RUN+="/sbin/modprobe -b --all ms_block mspro_block" ++SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", \ ++ RUN+="/sbin/modprobe -b tifm_sd" ++SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", \ ++ RUN+="/sbin/modprobe -b tifm_ms" ++ ++SUBSYSTEM=="scsi_device", ATTRS{type}=="[235689]", TEST!="[module/sg]", \ ++ RUN+="/sbin/modprobe -b sg" ++ ++SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe -b ide-scsi" ++ ++# Load VIO modules based on the device type ++SUBSYSTEM!="vio", GOTO="hotplug_vio_end" ++ENV{MODALIAS}=="?*", GOTO="hotplug_vio_end" ++ENV{VIO_TYPE}!="?*", IMPORT{program}="vio_type --export $devpath" ++ENV{VIO_TYPE}=="serial", RUN+="/sbin/modprobe -b hvc_console" ++ENV{VIO_TYPE}=="serial-server", RUN+="/sbin/modprobe -b hvcs" ++ENV{VIO_TYPE}=="network", RUN+="/sbin/modprobe -b ibmveth" ++ENV{VIO_TYPE}=="vscsi", RUN+="/sbin/modprobe -b ibmvscsic" ++ENV{VIO_TYPE}=="vlan", RUN+="/sbin/modprobe -b iseries_veth" ++ENV{VIO_TYPE}=="viodasd", RUN+="/sbin/modprobe -b viodasd" ++ENV{VIO_TYPE}=="viocd", RUN+="/sbin/modprobe -b viocd" ++ENV{VIO_TYPE}=="vnet", RUN+="/sbin/modprobe -b sunvnet" ++ENV{VIO_TYPE}=="vdisk", RUN+="/sbin/modprobe -b sunvdc" ++LABEL="hotplug_vio_end" ++ ++# From here on follows the hotplug agents which do not load modules ++LABEL="hotplug_driver_loaded" ++ ++SUBSYSTEM=="firmware", RUN+="firmware.agent" ++ ++LABEL="drivers_end" ++ ++SUBSYSTEM=="net", RUN+="net.agent" ++ ++SUBSYSTEM=="atm", RUN+="dsl-modem.agent" ++ ++# Log every event to /dev/hotplug.log (for debugging). ++#SUBSYSTEM!="uids", RUN+="logger.agent" ++ diff --git a/packaging/udev-firmware.patch b/packaging/udev-firmware.patch new file mode 100755 index 0000000..7375def --- /dev/null +++ b/packaging/udev-firmware.patch @@ -0,0 +1,38 @@ +--- udev/extra/firmware.agent 1970-01-01 09:00:00.000000000 +0900 ++++ udev-174/extra/firmware.agent 2012-07-30 17:13:34.629317386 +0900 +@@ -0,0 +1,35 @@ ++#!/bin/sh -e ++# ++# firmware loader agent ++# ++ ++cd /lib/udev/ ++. ./hotplug.functions ++ ++if [ ! -e /sys/$DEVPATH/loading ]; then ++ mesg "/sys/$DEVPATH/ does not exist" ++ exit 1 ++fi ++ ++FIRMWARE_DIRS="/lib/firmware/$(uname -r) /lib/firmware /usr/local/lib/firmware /usr/lib/hotplug/firmware" ++ ++for DIR in $FIRMWARE_DIRS; do ++ [ -e "$DIR/$FIRMWARE" ] || continue ++ echo 1 > /sys/$DEVPATH/loading ++ cat "$DIR/$FIRMWARE" > /sys/$DEVPATH/data ++ echo 0 > /sys/$DEVPATH/loading ++ exit 0 ++done ++ ++# the firmware was not found ++echo -1 > /sys/$DEVPATH/loading ++ ++if [ -d /dev/.udev/ ]; then ++ mkdir -p /dev/.udev/firmware-missing/ ++ file=$(echo "$FIRMWARE" | sed -e 's#/#\\x2f#g') ++ ln -s -f "$DEVPATH" /dev/.udev/firmware-missing/$file ++fi ++ ++debug_mesg "Cannot find the $FIRMWARE firmware" ++exit 1 ++ diff --git a/packaging/udev-hotplug.patch b/packaging/udev-hotplug.patch new file mode 100755 index 0000000..ca044e5 --- /dev/null +++ b/packaging/udev-hotplug.patch @@ -0,0 +1,65 @@ +diff -ruN udev-166/extra/hotplug.functions udev/extra/hotplug.functions +--- udev-166/extra/hotplug.functions 1970-01-01 09:00:00.000000000 +0900 ++++ udev/extra/hotplug.functions 2011-05-25 20:30:10.000000000 +0900 +@@ -0,0 +1,61 @@ ++# Setup and shell utility functions for use in hotplug agents. ++# vim: syntax=sh ++# ++# This program is free software; you can redistribute it and/or modify it ++# under the terms of the GNU General Public License as published by the ++# Free Software Foundation version 2 of the License. ++ ++if [ "$UDEV_LOG" ] && [ "$UDEV_LOG" -ge 7 ]; then ++ DEBUG=yes ++fi ++ ++PATH='/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin' ++ ++[ -e /etc/default/hotplug ] && . /etc/default/hotplug ++ ++ ++if [ -x /usr/bin/logger ]; then ++ LOGGER=/usr/bin/logger ++elif [ -x /bin/logger ]; then ++ LOGGER=/bin/logger ++else ++ unset LOGGER ++fi ++ ++# for diagnostics ++if [ -t 1 -a -z "$LOGGER" ] || [ ! -e '/dev/log' ]; then ++ mesg() { ++ echo "$@" >&2 ++ } ++elif [ -t 1 ]; then ++ mesg() { ++ echo "$@" ++ $LOGGER -t "${0##*/}[$$]" "$@" ++ } ++else ++ mesg() { ++ $LOGGER -t "${0##*/}[$$]" "$@" ++ } ++fi ++ ++debug_mesg() { ++ [ -z "$DEBUG" -o "$DEBUG" = no ] && return 0 ++ mesg "$@" ++} ++ ++wait_for_file() { ++ local file=$1 ++ local timeout=$2 ++ [ "$timeout" ] || timeout=120 ++ ++ local count=$timeout ++ while [ $count != 0 ]; do ++ [ -e "$file" ] && return 0 ++ sleep 1 ++ count=$(($count - 1)) ++ done ++ ++ mesg "$file did not appear before the timeout!" ++ exit 1 ++} ++ diff --git a/packaging/udev.init b/packaging/udev.init deleted file mode 100644 index a9b8db2..0000000 --- a/packaging/udev.init +++ /dev/null @@ -1,319 +0,0 @@ -#!/bin/sh -e -### BEGIN INIT INFO -# Provides: udev -# Required-Start: mountkernfs -# Required-Stop: -# Default-Start: S -# Default-Stop: -# X-Interactive: true -# Short-Description: Start udevd, populate /dev and load drivers. -### END INIT INFO - -# we need to unmount /dev/pts/ and remount it later over the tmpfs -unmount_devpts() { - if mountpoint -q /dev/pts/; then - umount -n -l /dev/pts/ - fi - - if mountpoint -q /dev/shm/; then - umount -n -l /dev/shm/ - fi -} - -# mount a tmpfs over /dev, if somebody did not already do it -mount_tmpfs() { - if grep -E -q "^[^[:space:]]+ /dev (dev)?tmpfs" /proc/mounts; then - mount -n -o remount,${dev_mount_options} -t tmpfs tmpfs /dev - return - fi - - if ! mount -n -o $dev_mount_options -t tmpfs tmpfs /dev; then - log_failure_msg "udev requires tmpfs support, not started." - log_end_msg 1 - fi - - return 0 -} - -create_dev_makedev() { - if [ -e /sbin/MAKEDEV ]; then - ln -sf /sbin/MAKEDEV /dev/MAKEDEV - else - ln -sf /bin/true /dev/MAKEDEV - fi -} - -supported_kernel() { - case "$(uname -r)" in - 2.[012345].*|2.6.[0-9]|2.6.[0-9][!0-9]*) return 1 ;; - 2.6.1[0-9]|2.6.1[0-9][!0-9]*) return 1 ;; - 2.6.2[0-6]|2.6.2[0-6][!0-9]*) return 1 ;; - esac - return 0 -} - -# shell version of /usr/bin/tty -my_tty() { - [ -x /bin/readlink ] || return 0 - [ -e /proc/self/fd/0 ] || return 0 - readlink --silent /proc/self/fd/0 || true -} - -warn_if_interactive() { - if [ "$RUNLEVEL" = "S" -a "$PREVLEVEL" = "N" ]; then - return - fi - - TTY=$(my_tty) - if [ -z "$TTY" -o "$TTY" = "/dev/console" -o "$TTY" = "/dev/null" ]; then - return - fi - - printf "\n\n\nIt has been detected that the command\n\n\t$0 $*\n\n" - printf "has been run from an interactive shell.\n" - printf "It will probably not do what you expect, so this script will wait\n" - printf "60 seconds before continuing. Press ^C to stop it.\n" - printf "RUNNING THIS COMMAND IS HIGHLY DISCOURAGED!\n\n\n\n" - sleep 60 -} - -create_dev_root_rule() { - local udevroot="$1" - [ -e $udevroot/rules.d/61-dev-root-link.rules ] && return 0 - - eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ \ - || true) - [ "$ROOT_MAJOR" -a "$ROOT_MINOR" ] || return 0 - - echo 'ACTION=="add|change", SUBSYSTEM=="block", ENV{MAJOR}=="'$ROOT_MAJOR'", ENV{MINOR}=="'$ROOT_MINOR'", SYMLINK+="root"' \ - > $udevroot/root-link-rule - mv $udevroot/root-link-rule $udevroot/rules.d/61-dev-root-link.rules -} - -############################################################################## - -[ -x /sbin/udevd ] || exit 0 - -PATH="/sbin:/bin" - -# defaults -tmpfs_size="10M" -udev_root="/dev" - -if [ -e /etc/udev/udev.conf ]; then - . /etc/udev/udev.conf -fi - -. /lib/lsb/init-functions - -if ! supported_kernel; then - log_failure_msg "udev requires a kernel >= 2.6.27, not started." - log_end_msg 1 -fi - -if [ ! -e /proc/filesystems ]; then - log_failure_msg "udev requires a mounted procfs, not started." - log_end_msg 1 -fi - -if ! grep -q '[[:space:]]tmpfs$' /proc/filesystems; then - log_failure_msg "udev requires tmpfs support, not started." - log_end_msg 1 -fi - -if [ ! -d /sys/class/ ]; then - log_failure_msg "udev requires a mounted sysfs, not started." - log_end_msg 1 -fi - -if [ ! -e /sys/kernel/uevent_helper ]; then - log_failure_msg "udev requires hotplug support, not started." - log_end_msg 1 -fi - -############################################################################## - -# this is experimental and may not work well -if [ "$UDEV_DISABLED" = "yes" ]; then - udev_root=/etc/udev/.dev - export UDEV_ROOT=$udev_root -fi - -udev_root=${udev_root%/} - -dev_mount_options='mode=0755' -if [ "$tmpfs_size" ]; then - dev_mount_options="size=${tmpfs_size},${dev_mount_options}" -fi - -if [ "$udev_root" != "/dev" ]; then - log_warning_msg "udev_root != /dev/" - -case "$1" in - start) - if [ -e "$udev_root/.udev/" ]; then - if mountpoint -q $udev_root/; then - log_failure_msg "udev is already active on $udev_root." - log_end_msg 1 - else - log_warning_msg ".udev/ already exists on the static $udev_root!" - fi - fi - - echo > /sys/kernel/uevent_helper - - mount -n -o $dev_mount_options -t tmpfs tmpfs $udev_root - - log_daemon_msg "Starting the hotplug events dispatcher" "udevd" - if udevd --daemon; then - log_end_msg $? - else - log_end_msg $? - fi - - mkdir -p $udev_root/.udev/rules.d/ - create_dev_root_rule $udev_root/.udev/ - - log_action_begin_msg "Synthesizing initial hotplug events" - if udevadm trigger --action=add; then - log_action_end_msg $? - else - log_action_end_msg $? - fi - - ;; - stop) - log_daemon_msg "Stopping the hotplug events dispatcher" "udevd" - if start-stop-daemon --stop --name udevd --quiet --oknodo --retry 5; then - log_end_msg $? - else - log_end_msg $? - fi - - log_action_begin_msg "Unmounting $udev_root" - # unmounting with -l should never fail - if umount -n -l $udev_root; then - log_action_end_msg $? - else - log_action_end_msg $? - fi - ;; - - restart) - $0 stop - $0 start - ;; - - reload|force-reload) - udevadm control --reload-rules - ;; - - *) - echo "Usage: /etc/init.d/udev {start|stop|restart|reload|force-reload}" - exit 1 - ;; -esac - - exit 0 -fi # udev_root != /dev - -############################################################################## - -# When modifying this script, do not forget that between the time that the -# new /dev has been mounted and udevadm trigger has been run there will be -# no /dev/null. This also means that you cannot use the "&" shell command. - -case "$1" in - start) - if [ -e "$udev_root/.udev/" ]; then - if mountpoint -q $udev_root/; then - TMPFS_MOUNTED=1 - else - log_warning_msg ".udev/ already exists on the static $udev_root!" - fi - else - warn_if_interactive - fi - - echo > /sys/kernel/uevent_helper - - if [ -z "$TMPFS_MOUNTED" ]; then - unmount_devpts - mount_tmpfs - [ -d /proc/1 ] || mount -n /proc - else - # and clean up the database of the initramfs udev - rm -rf /dev/.udev/ - fi - - # set the SELinux context for devices created in the initramfs - [ -x /sbin/restorecon ] && /sbin/restorecon -R /dev - - # /dev/null must be created before udevd is started - /lib/udev/create_static_nodes || true - - log_daemon_msg "Starting the hotplug events dispatcher" "udevd" - if udevd --daemon; then - log_end_msg $? - else - log_end_msg $? - fi - - mkdir -p /dev/.udev/rules.d/ - create_dev_root_rule /dev/.udev/ - - log_action_begin_msg "Synthesizing the initial hotplug events" - if udevadm trigger --action=add; then - log_action_end_msg $? - else - log_action_end_msg $? - fi - - create_dev_makedev - - # wait for the udevd childs to finish - log_action_begin_msg "Waiting for /dev to be fully populated" - if udevadm settle; then - log_action_end_msg 0 - else - log_action_end_msg 0 'timeout' - fi - ;; - - stop) - log_daemon_msg "Stopping the hotplug events dispatcher" "udevd" - if start-stop-daemon --stop --name udevd --quiet --oknodo --retry 5; then - log_end_msg $? - else - log_end_msg $? - fi - ;; - - restart) - log_daemon_msg "Stopping the hotplug events dispatcher" "udevd" - if start-stop-daemon --stop --name udevd --quiet --oknodo --retry 5; then - log_end_msg $? - else - log_end_msg $? || true - fi - - log_daemon_msg "Starting the hotplug events dispatcher" "udevd" - if udevd --daemon; then - log_end_msg $? - else - log_end_msg $? - fi - ;; - - reload|force-reload) - udevadm control --reload-rules - ;; - - *) - echo "Usage: /etc/init.d/udev {start|stop|restart|reload|force-reload}" - exit 1 - ;; -esac - -exit 0 - diff --git a/packaging/udev.spec b/packaging/udev.spec old mode 100644 new mode 100755 index 1489920..9c6e302 --- a/packaging/udev.spec +++ b/packaging/udev.spec @@ -1,17 +1,19 @@ Name: udev -Version: 166 +Version: 174 Release: 1 License: GPLv2 Summary: A userspace implementation of devfs Group: System/Base Source0: http://www.kernel.org/pub/linux/utils/kernel/hotplug/%{name}-%{version}.tar.gz -#Source1: start_udev -Source2: udev.spec -Source3: udev.udev-mtab.init +Source1: start_udev %define udev_libdir /lib/udev %define firmwaredir /lib/firmware +Patch0: udev-firmware.patch +Patch1: udev-80-drivers.patch +Patch2: udev-hotplug.patch + Url: http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html BuildRequires: bison BuildRequires: findutils @@ -35,6 +37,14 @@ Obsoletes: udev-extra The udev package contains an implementation of devfs in userspace using sysfs and netlink. +%package rules-nondefault +Summary: Udev rules not used in normal installs +Group: System/base +Requires: udev = %{version} + +%description rules-nondefault +This package contains a set of udev rules not used in normal installs + %package -n libudev Summary: Library for accessing udev functionality Group: Development/Libraries @@ -80,7 +90,9 @@ glib-based applications using libudev functionality. %prep %setup -q - +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 %build libtoolize -f -c @@ -98,18 +110,13 @@ make %{?_smp_mflags} %make_install -mkdir -p %{buildroot}/etc/udev/ -mkdir -p %{buildroot}/etc/modprobe.d/ -mkdir -p %{buildroot}/etc/init.d/ - -#install -m 0755 %{SOURCE1} $RPM_BUILD_ROOT/sbin/start_udev +install -m 0755 %{SOURCE1} $RPM_BUILD_ROOT/sbin/start_udev install -m 0755 ./udev/udevd $RPM_BUILD_ROOT/sbin/udevd -install -m 644 extra/blacklist.conf extra/fbdev-blacklist.conf \ - %{buildroot}/etc/modprobe.d/ -cp -a extra/links.conf %{buildroot}/etc/udev/links.conf -cp -a %{SOURCE2} %{buildroot}/etc/init.d/udev -cp -a %{SOURCE3} %{buildroot}/etc/init.d/udev-mtab +install -m 0755 extra/*.agent $RPM_BUILD_ROOT/lib/udev/ +cp extra/hotplug.functions $RPM_BUILD_ROOT/lib/udev/ + +cp rules/debian/80-drivers.rules $RPM_BUILD_ROOT/lib/udev/rules.d/ %post @@ -124,32 +131,48 @@ cp -a %{SOURCE3} %{buildroot}/etc/init.d/udev-mtab %postun -n libgudev1 -p /sbin/ldconfig +%triggerpostun -- dev <= 0:3.12-1 +if [ $2 = 0 ]; then + if [ -x /sbin/MAKEDEV ]; then + /sbin/MAKEDEV null + else + /bin/mknod /dev/null c 1 3 + fi + /sbin/start_udev >/dev/null 2>&1 + if [ -e /dev/mapper/control -a -x /sbin/lvm ]; then + /sbin/lvm vgmknodes >/dev/null 2>&1 + fi +fi +exit 0 + + +%triggerin -- MAKEDEV +rm -f /var/lib/udev/makenode.d/* >/dev/null 2>&1 || : + %clean rm -rf %{buildroot} %files %defattr(0644, root, root, 0755) -%attr(0755,root,root) /sbin/udevadm -%attr(0755,root,root) /sbin/udevd +%doc COPYING README %attr(0755,root,root) /%{_lib}/udev/keymaps/* %attr(0755,root,root) /%{_lib}/udev/* - -/lib/udev/rules.d/* -/lib/systemd/system/udev.service -/lib/systemd/system/udev-retry.service +%attr(0755,root,root) /sbin/start_udev +%attr(0755,root,root) /sbin/udevd +%attr(0755,root,root) /sbin/udevadm +/etc/udev/udev.conf +/lib/systemd/system/basic.target.wants/udev-trigger.service /lib/systemd/system/basic.target.wants/udev.service -/lib/systemd/system/basic.target.wants/udev-retry.service -/lib/systemd/system/basic.target.wants/udev-settle.service +/lib/systemd/system/sockets.target.wants/udev-control.socket +/lib/systemd/system/sockets.target.wants/udev-kernel.socket +/lib/systemd/system/udev-control.socket +/lib/systemd/system/udev-kernel.socket /lib/systemd/system/udev-settle.service -/etc/udev/udev.conf -/etc/udev/links.conf -/etc/modprobe.d/fbdev-blacklist.conf -/etc/modprobe.d/blacklist.conf -/etc/init.d/udev -/etc/init.d/udev-mtab +/lib/systemd/system/udev-trigger.service +/lib/systemd/system/udev.service -#%files +%files rules-nondefault %attr(0755,root,root) %{udev_libdir}/rules.d/42-qemu-usb.rules %attr(0755,root,root) %{udev_libdir}/rules.d/50-firmware.rules %attr(0755,root,root) %{udev_libdir}/rules.d/50-udev-default.rules @@ -160,7 +183,7 @@ rm -rf %{buildroot} %attr(0755,root,root) %{udev_libdir}/rules.d/60-persistent-storage-tape.rules %attr(0755,root,root) %{udev_libdir}/rules.d/60-persistent-serial.rules %attr(0755,root,root) %{udev_libdir}/rules.d/60-persistent-v4l.rules -#%attr(0755,root,root) %{udev_libdir}/rules.d/61-accelerometer.rules +%attr(0755,root,root) %{udev_libdir}/rules.d/61-accelerometer.rules %attr(0755,root,root) %{udev_libdir}/rules.d/75-net-description.rules %attr(0755,root,root) %{udev_libdir}/rules.d/75-probe_mtd.rules %attr(0755,root,root) %{udev_libdir}/rules.d/75-tty-description.rules @@ -171,26 +194,33 @@ rm -rf %{buildroot} %attr(0755,root,root) %{udev_libdir}/rules.d/95-udev-late.rules %files -n libudev -/%{_lib}/libudev.so.* +%defattr(0644, root, root, 0755) +%doc COPYING +%attr(0755,root,root) /%{_lib}/libudev.so.* %files -n libudev-devel %defattr(0644, root, root, 0755) +%doc COPYING +%doc TODO ChangeLog extras/keymap/README.keymap.txt %attr(0644,root,root) %{_mandir}/man8/udev*.8* %attr(0644,root,root) %{_mandir}/man7/udev*.7* %attr(0644,root,root) %{_mandir}/man8/scsi_id*.8* /usr/include/libudev.h /usr/lib/libudev.so /usr/lib/pkgconfig/libudev.pc +/usr/share/doc/udev/README.keymap.txt /usr/share/pkgconfig/udev.pc /usr/share/gtk-doc/html/libudev/* -/usr/share/doc/udev/* -%exclude %{_libdir}/ConsoleKit/* %files -n libgudev1 -/%{_lib}/libgudev-1.0.so.* +%defattr(0644, root, root, 0755) +%doc COPYING +%attr(0755,root,root) /%{_lib}/libgudev-1.0.so.* %files -n libgudev1-devel -%{_libdir}/libgudev-1.0.so -%{_includedir}/gudev-1.0/gudev/*.h -%{_libdir}/pkgconfig/gudev-1.0* +%defattr(0644, root, root, 0755) +%doc COPYING +%attr(0755,root,root) %{_libdir}/libgudev-1.0.so +%attr(0644,root,root) %{_includedir}/gudev-1.0/gudev/*.h +%attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0* %{_datadir}/gtk-doc/html/gudev/* diff --git a/packaging/udev.udev-mtab.init b/packaging/udev.udev-mtab.init deleted file mode 100644 index 1496426..0000000 --- a/packaging/udev.udev-mtab.init +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -e -### BEGIN INIT INFO -# Provides: udev-mtab -# Required-Start: udev $local_fs -# Required-Stop: -# Default-Start: S -# Default-Stop: -# Short-Description: Add to mtab the entry for /dev. -### END INIT INFO - -PATH="/sbin:/bin" - -case "$1" in - start) ;; - stop|restart|force-reload) exit 0 ;; - *) echo "Usage: $0 {start|stop|restart|force-reload}" >&2; exit 1 ;; -esac - -# copy the rules generated before / was mounted read-write -for file in /dev/.udev/tmp-rules--*; do - dest=${file##*tmp-rules--} - [ "$dest" = '*' ] && break - cat $file >> /etc/udev/rules.d/$dest - rm -f $file -done - - -# if it's not, it's probably a symlink to /proc/mounts -[ -w /etc/mtab ] || exit 0 - -# defaults -tmpfs_size="10M" -udev_root="/dev/" - -if [ -e /etc/udev/udev.conf ]; then - . /etc/udev/udev.conf -fi - -# strip the trailing slash -udev_root=${udev_root%/} - -if mountpoint -q $udev_root; then - if ! grep -E --quiet --no-messages "^[^ ]+ +$udev_root +" /etc/mtab; then - mtabline="$(grep -E --no-messages "^[^ ]+ +$udev_root +(dev)?tmpfs +" /proc/mounts || true)" - if [ "$mtabline" ]; then - echo "$mtabline" >> /etc/mtab - fi - fi -fi - -exit 0 - diff --git a/rules/debian/50-udev-default.rules b/rules/debian/50-udev-default.rules deleted file mode 100644 index 451933f..0000000 --- a/rules/debian/50-udev-default.rules +++ /dev/null @@ -1,100 +0,0 @@ -# import the properties of optical drives -ACTION!="remove", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", \ - KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]|xvd*", \ - IMPORT{program}="cdrom_id --export $tempnode" - -# SCSI devices -SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", SYMLINK+="scd%n" -SUBSYSTEM=="bsg", NAME="bsg/%k" - -# workaround for kernels < 2.6.30 -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", WAIT_FOR="descriptors" - -# USB devices -SUBSYSTEMS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="dabusb[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="hiddev[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="legousbtower[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="iowarrior[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ - ATTRS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*|[Pp]alm*Handheld*", \ - SYMLINK+="pilot" - -# usbfs-like devices -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" - -# serial devices -KERNEL=="capi", NAME="capi20" -KERNEL=="capi[0-9]*", NAME="capi/%n" - -# video devices -KERNEL=="dvb*", ENV{DVB_ADAPTER_NUM}=="?*", NAME="dvb/adapter$env{DVB_ADAPTER_NUM}/$env{DVB_DEVICE_TYPE}$env{DVB_DEVICE_NUM}" -# workaround for kernels < 2.6.29 -KERNEL=="dvb*", ENV{DVB_ADAPTER_NUM}=="", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", ACTION!="remove", \ - NAME="$result" -KERNEL=="card[0-9]*", NAME="dri/%k" - -# virtio serial / console ports -KERNEL=="vport*", ATTR{name}=="?*", SYMLINK+="virtio-ports/$attr{name}" - -# misc devices -KERNEL=="hw_random", NAME="hwrng" -KERNEL=="tun", NAME="net/%k" -KERNEL=="evtchn", NAME="xen/%k" -SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc" - -KERNEL=="rawctl", NAME="raw/rawctl" -KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" -KERNEL=="pktcdvd", NAME="pktcdvd/control" - -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode" - -KERNEL=="umad*", NAME="infiniband/%k" -KERNEL=="issm*", NAME="infiniband/%k" -KERNEL=="uverbs*", NAME="infiniband/%k" -KERNEL=="ucm*", NAME="infiniband/%k" -KERNEL=="uat", NAME="infiniband/%k" -KERNEL=="ucma", NAME="infiniband/%k" -KERNEL=="rdma_cm", NAME="infiniband/%k" - -# ALSA devices -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hwC[D0-9]*", NAME="snd/%k" -KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" - -KERNEL=="snd", SUBSYSTEM=="module", ACTION=="add", \ - RUN+="/bin/ln -sf /proc/asound/oss/sndstat $root/sndstat" - - -# ieee1394 devices -KERNEL=="dv1394*", NAME="dv1394/%n" -KERNEL=="video1394*", NAME="video1394/%n" - -# input devices -KERNEL=="mice", NAME="input/%k" -KERNEL=="mouse[0-9]*", NAME="input/%k" -KERNEL=="event[0-9]*", NAME="input/%k" -KERNEL=="js[0-9]*", NAME="input/%k" -KERNEL=="ts[0-9]*", NAME="input/%k" - -# Zaptel -KERNEL=="zapctl", NAME="zap/ctl" -KERNEL=="zapchannel", NAME="zap/channel" -KERNEL=="zappseudo", NAME="zap/pseudo" -KERNEL=="zaptimer", NAME="zap/timer" -KERNEL=="transcode", NAME="zap/transcode" -KERNEL=="zap[0-9]*", NAME="zap/%n" - -# AOE character devices -SUBSYSTEM=="aoe", NAME="etherd/%k" - -KERNEL=="device-mapper", NAME="mapper/control" - diff --git a/rules/debian/60-persistent-storage-tape.rules b/rules/debian/60-persistent-storage-tape.rules deleted file mode 100644 index 9618d05..0000000 --- a/rules/debian/60-persistent-storage-tape.rules +++ /dev/null @@ -1,41 +0,0 @@ -# This file contains the rules needed to create persistent device names. - -# we are only interested in add and change actions for block devices -ACTION=="remove", GOTO="persistent_storage_tape_end" - -# "Medium Changers" -SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", \ - IMPORT{program}="scsi_id --export --sg-version=3 --whitelisted --device=$tempnode" - -KERNEL=="sg[0-9]*", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" - -SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" - -KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", \ - ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \ - SUBSYSTEMS=="usb", \ - IMPORT{program}="usb_id --export $devpath" - -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \ - SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", \ - ENV{.BSG_DEV}="$root/bsg/$id" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \ - WAIT_FOR="$env{.BSG_DEV}", \ - ENV{ID_BUS}="scsi", \ - IMPORT{program}="scsi_id --export --device=$env{.BSG_DEV}" - -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -KERNEL=="st*[0-9]|nst*[0-9]", \ - IMPORT{program}="path_id $devpath" -KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", \ - SYMLINK+="tape/by-path/$env{ID_PATH}" -KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", \ - SYMLINK+="tape/by-path/$env{ID_PATH}-nst" - -# end of processing -LABEL="persistent_storage_tape_end" - diff --git a/rules/debian/60-persistent-storage.rules b/rules/debian/60-persistent-storage.rules deleted file mode 100644 index 37609c8..0000000 --- a/rules/debian/60-persistent-storage.rules +++ /dev/null @@ -1,149 +0,0 @@ -# This file contains the rules needed to create persistent device names. - -# forward scsi device events to the corresponding block device -ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", \ - TEST=="block", ATTR{block/*/uevent}="change" - -# we are only interested in add and change actions for block devices -ACTION=="remove", GOTO="persistent_storage_end" -SUBSYSTEM!="block", GOTO="persistent_storage_end" - -# and we can safely ignore these kinds of devices -KERNEL=="fd[0-9]*|mtd[0-9]*|mtdblock[0-9]*|nbd[0-9]*|gnbd[0-9]*|dm-[0-9]*|md[0-9]*|btibm[0-9]*", \ - GOTO="persistent_storage_end" - -# skip removable ide devices, because open(2) on them causes an events loop -KERNEL=="hd*[!0-9]", ATTR{removable}=="1", \ - SUBSYSTEMS=="ide", ATTRS{media}=="disk|floppy", \ - GOTO="persistent_storage_end" -KERNEL=="hd*[0-9]", ATTRS{removable}=="1", \ - GOTO="persistent_storage_end" - -# ignore partitions that span the entire disk -TEST=="whole_disk", GOTO="persistent_storage_end" - -# workaround for kernels < 2.6.25-rc1 -ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk" -ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition" - -# partitions do not have hardware identificators -ENV{DEVTYPE}!="disk", GOTO="persistent_storage_not_a_disk" -# nor do paravirtualized hard disks -KERNEL=="vd*", GOTO="persistent_storage_not_a_disk" - -# look for different kinds of unique identificators -KERNEL=="hd*", \ - IMPORT{program}="ata_id --export $tempnode" - -KERNEL=="mmcblk[0-9]", ATTRS{name}=="?*", ATTRS{serial}=="?*", \ - ENV{ID_BUS}="memstick", ENV{ID_SERIAL}="$attr{name}_$attr{serial}" -KERNEL=="mspblk[0-9]", ATTRS{name}=="?*", ATTRS{serial}=="?*", \ - ENV{ID_BUS}="mmc", ENV{ID_SERIAL}="$attr{name}_$attr{serial}" - -KERNEL=="sd*|sr*", ATTRS{ieee1394_id}=="?*", \ - ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}" - -KERNEL=="vd*", ATTRS{serial}=="?*", \ - ENV{ID_BUS}="virtio", ENV{ID_SERIAL}="$attr{serial}" - -# USB devices use their own serial number -KERNEL=="sd*|sr*", ENV{ID_SERIAL}!="?*", \ - SUBSYSTEMS=="usb", \ - IMPORT{program}="usb_id --export $devpath" -# ATA devices with their own "ata" kernel subsystem -KERNEL=="sd*|sr*", ENV{ID_SERIAL}!="?*", \ - SUBSYSTEMS=="ata", \ - IMPORT{program}="ata_id --export $tempnode" -# ATA devices using the "scsi" subsystem -KERNEL=="sd*|sr*", ENV{ID_SERIAL}!="?*", \ - SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", \ - IMPORT{program}="ata_id --export $tempnode" -# scsi devices -KERNEL=="sd*|sr*", ENV{ID_SERIAL}!="?*", \ - ENV{ID_BUS}="scsi", \ - IMPORT{program}="scsi_id --export --whitelisted --device=$tempnode" - -KERNEL=="cciss*", ENV{ID_SERIAL}!="?*", \ - ENV{ID_BUS}="cciss", \ - IMPORT{program}="scsi_id --export --whitelisted --device=$tempnode" - -KERNEL=="dasd*", \ - IMPORT{program}="dasd_id --export $tempnode" - -KERNEL=="sd*|hd*|cciss*", \ - IMPORT{program}="edd_id --export $tempnode" - -# scsi compat links for ATA devices -KERNEL=="sd*", ENV{ID_BUS}=="ata", \ - PROGRAM="scsi_id --whitelisted --replace-whitespace -p0x80 -d$tempnode", \ - RESULT=="?*", ENV{ID_SCSI_COMPAT}="$result" - -# find the physical path of the device -ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", \ - IMPORT{program}="path_id $devpath" - -LABEL="persistent_storage_not_a_disk" - -# import the variables of partitions from the parent disks -ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" - -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="disk/by-id/ata-$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="disk/by-id/ata-$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]", ENV{ID_SCSI_COMPAT}=="?*", \ - SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}" -KERNEL=="sd*[0-9]", ENV{ID_SCSI_COMPAT}=="?*", \ - SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}-part%n" - -ENV{DEVTYPE}=="disk", ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -ENV{DEVTYPE}=="partition", ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", \ - SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", \ - SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -ENV{DEVTYPE}=="disk", ENV{ID_WWN}=="?*", \ - SYMLINK+="disk/by-id/wwn-$env{ID_WWN}" -ENV{DEVTYPE}=="partition", ENV{ID_WWN}=="?*", \ - SYMLINK+="disk/by-id/wwn-$env{ID_WWN}-part%n" - -# by-path (parent device path) -ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", \ - SYMLINK+="disk/by-path/$env{ID_PATH}" -ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", \ - SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# skip unpartitioned removable media devices from drivers which do not send -# "change" events -ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", \ - GOTO="persistent_storage_end" - -# probe filesystem metadata of optical drives which have a media inserted -KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", \ - ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", \ - IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" -# single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET -KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", \ - ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", \ - IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode" - -# probe filesystem metadata of disks -KERNEL!="sr*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode" - -# watch for future changes -KERNEL!="sr*", OPTIONS+="watch" - -# by-label/by-uuid links (filesystem metadata) -ENV{ID_FS_UUID_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other|crypto", \ - SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -ENV{ID_FS_LABEL_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", \ - SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" - -LABEL="persistent_storage_end" - diff --git a/rules/debian/75-cd-aliases-generator.rules b/rules/debian/75-cd-aliases-generator.rules deleted file mode 100644 index 6b178a0..0000000 --- a/rules/debian/75-cd-aliases-generator.rules +++ /dev/null @@ -1,11 +0,0 @@ -# These rules generate rules for the /dev/{cdrom,dvd,...} symlinks and -# write them to /etc/udev/rules.d/70-persistent-cd.rules. - -ACTION=="add", SUBSYSTEM=="block", ENV{GENERATED}!="?*", ENV{ID_CDROM}=="?*", \ - SUBSYSTEMS!="usb|ieee1394", \ - PROGRAM="write_cd_rules", SYMLINK+="$result" - -ACTION=="add", SUBSYSTEM=="block", ENV{GENERATED}!="?*", ENV{ID_CDROM}=="?*", \ - SUBSYSTEMS=="usb|ieee1394", \ - PROGRAM="write_cd_rules by-id", SYMLINK+="$result" - diff --git a/rules/debian/75-persistent-net-generator.rules b/rules/debian/75-persistent-net-generator.rules deleted file mode 100644 index 012dfb9..0000000 --- a/rules/debian/75-persistent-net-generator.rules +++ /dev/null @@ -1,116 +0,0 @@ -# These rules generate rules to keep network interface names unchanged -# across reboots and write them to /etc/udev/rules.d/70-persistent-net.rules. - -# variables used to communicate: -# MATCHADDR MAC address used for the match -# MATCHID bus_id used for the match -# MATCHDRV driver name used for the match -# MATCHIFTYPE interface type match -# COMMENT comment to add to the generated rule -# INTERFACE_NAME requested name supplied by external tool -# INTERFACE_NEW new interface name returned by rule writer - -ACTION!="add", GOTO="persistent_net_generator_end" -SUBSYSTEM!="net", GOTO="persistent_net_generator_end" - -# ignore the interface if a name has already been set -NAME=="?*", GOTO="persistent_net_generator_end" - -# device name whitelist -KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", \ - GOTO="persistent_net_generator_end" - -# ignore Xen virtual interfaces -SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end" - -# ignore UML virtual interfaces -DRIVERS=="uml-netdev", GOTO="persistent_net_generator_end" - -# ignore "secondary" raw interfaces of the madwifi driver -KERNEL=="ath*", ATTRS{type}=="802", GOTO="persistent_net_generator_end" - -# ignore "secondary" monitor interfaces of mac80211 drivers -KERNEL=="wlan*", ATTRS{type}=="803", GOTO="persistent_net_generator_end" - -# by default match on the MAC address and interface type -ENV{MATCHADDR}="$attr{address}" -ENV{MATCHIFTYPE}="$attr{type}" - -# match interface dev_id -ATTR{dev_id}=="?*", ENV{MATCHDEVID}="$attr{dev_id}" - -# These vendors are known to violate the local MAC address assignment scheme -# Interlan, DEC (UNIBUS or QBUS), Apollo, Cisco, Racal-Datacom -ENV{MATCHADDR}=="02:07:01:*", GOTO="globally_administered_whitelist" -# 3Com -ENV{MATCHADDR}=="02:60:60:*", GOTO="globally_administered_whitelist" -# 3Com IBM PC; Imagen; Valid; Cisco; Apple -ENV{MATCHADDR}=="02:60:8c:*", GOTO="globally_administered_whitelist" -# Intel -ENV{MATCHADDR}=="02:a0:c9:*", GOTO="globally_administered_whitelist" -# Olivetti -ENV{MATCHADDR}=="02:aa:3c:*", GOTO="globally_administered_whitelist" -# CMC Masscomp; Silicon Graphics; Prime EXL -ENV{MATCHADDR}=="02:cf:1f:*", GOTO="globally_administered_whitelist" -# Prominet Corporation Gigabit Ethernet Switch -ENV{MATCHADDR}=="02:e0:3b:*", GOTO="globally_administered_whitelist" -# BTI (Bus-Tech, Inc.) IBM Mainframes -ENV{MATCHADDR}=="02:e6:d3:*", GOTO="globally_administered_whitelist" -# Realtek -ENV{MATCHADDR}=="52:54:00:*", GOTO="globally_administered_whitelist" -# Novell 2000 -ENV{MATCHADDR}=="52:54:4c:*", GOTO="globally_administered_whitelist" -# Realtec -ENV{MATCHADDR}=="52:54:ab:*", GOTO="globally_administered_whitelist" -# Kingston Technologies -ENV{MATCHADDR}=="e2:0c:0f:*", GOTO="globally_administered_whitelist" - -# ignore interfaces with locally administered or null MAC addresses -# and KVM and VMWare virtual interfaces -ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}="" -ENV{MATCHADDR}=="00:00:00:00:00:00", ENV{MATCHADDR}="" -ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", ENV{MATCHADDR}="" -ENV{MATCHADDR}=="52:54:00:*|54:52:00:*", ENV{MATCHADDR}="" - -LABEL="globally_administered_whitelist" - -# ibmveth interfaces have stable locally administered MAC addresses -SUBSYSTEMS=="ibmveth", ENV{MATCHADDR}="$attr{address}" - -# S/390 interfaces are matched only by id -#SUBSYSTEMS=="ccwgroup", \ -# ENV{MATCHDRV}="$driver", ENV{MATCHID}="$id", ENV{MATCHADDR}="" - -# terminate processing if there are not enough conditions to create a rule -ENV{MATCHADDR}=="", ENV{MATCHID}=="", ENV{INTERFACE_NAME}=="", \ - GOTO="persistent_net_generator_end" - - -# provide nice comments for the generated rules -SUBSYSTEMS=="pci", \ - ENV{COMMENT}="PCI device $attr{vendor}:$attr{device}" -SUBSYSTEMS=="pcmcia", \ - ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id}" -SUBSYSTEMS=="usb", \ - ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct}" -SUBSYSTEMS=="ccwgroup", \ - ENV{COMMENT}="S/390 device at $id" -SUBSYSTEMS=="ibmveth", \ - ENV{COMMENT}="LPAR virtual device at $id" -SUBSYSTEMS=="ieee1394", \ - ENV{COMMENT}="Firewire device $attr{host_id}" -ENV{COMMENT}=="", \ - ENV{COMMENT}="Unknown $env{SUBSYSTEM} device ($env{DEVPATH})" -ATTRS{driver}=="?*", \ - ENV{COMMENT}="$env{COMMENT} ($attr{driver})" - - -# ignore interfaces without a driver link like bridges and VLANs, otherwise -# generate and write the rule -DRIVERS=="?*", IMPORT{program}="write_net_rules" - -# rename the interface if requested -ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" - -LABEL="persistent_net_generator_end" - diff --git a/rules/debian/80-drivers.rules b/rules/debian/80-drivers.rules deleted file mode 100644 index c5c0266..0000000 --- a/rules/debian/80-drivers.rules +++ /dev/null @@ -1,58 +0,0 @@ -ACTION=="remove", GOTO="drivers_end" - -# check if the device has already been claimed by a driver -ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_driver_loaded" - -# load the drivers -ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe -b $env{MODALIAS}" - -# workaround for kernels < 2.6.27-rc5 -SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", \ - RUN+="/bin/sh -c '/sbin/modprobe --use-blacklist --all $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" - -SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/modprobe -b pcmcia" - -# rules for subsystems which lack proper hotplug support -SUBSYSTEM=="i2o", RUN+="/sbin/modprobe -b i2o_block" -# workaround for kernels < 2.6.30 -SUBSYSTEM=="mmc", RUN+="/sbin/modprobe -b mmc_block" -SUBSYSTEM=="memstick", RUN+="/sbin/modprobe -b --all ms_block mspro_block" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", \ - RUN+="/sbin/modprobe -b tifm_sd" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", \ - RUN+="/sbin/modprobe -b tifm_ms" - -SUBSYSTEM=="scsi_device", ATTRS{type}=="[235689]", TEST!="[module/sg]", \ - RUN+="/sbin/modprobe -b sg" - -SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe -b ide-scsi" - -# Load VIO modules based on the device type -SUBSYSTEM!="vio", GOTO="hotplug_vio_end" -ENV{MODALIAS}=="?*", GOTO="hotplug_vio_end" -ENV{VIO_TYPE}!="?*", IMPORT{program}="vio_type --export $devpath" -ENV{VIO_TYPE}=="serial", RUN+="/sbin/modprobe -b hvc_console" -ENV{VIO_TYPE}=="serial-server", RUN+="/sbin/modprobe -b hvcs" -ENV{VIO_TYPE}=="network", RUN+="/sbin/modprobe -b ibmveth" -ENV{VIO_TYPE}=="vscsi", RUN+="/sbin/modprobe -b ibmvscsic" -ENV{VIO_TYPE}=="vlan", RUN+="/sbin/modprobe -b iseries_veth" -ENV{VIO_TYPE}=="viodasd", RUN+="/sbin/modprobe -b viodasd" -ENV{VIO_TYPE}=="viocd", RUN+="/sbin/modprobe -b viocd" -ENV{VIO_TYPE}=="vnet", RUN+="/sbin/modprobe -b sunvnet" -ENV{VIO_TYPE}=="vdisk", RUN+="/sbin/modprobe -b sunvdc" -LABEL="hotplug_vio_end" - -# From here on follows the hotplug agents which do not load modules -LABEL="hotplug_driver_loaded" - -SUBSYSTEM=="firmware", RUN+="firmware.agent" - -LABEL="drivers_end" - -SUBSYSTEM=="net", RUN+="net.agent" - -SUBSYSTEM=="atm", RUN+="dsl-modem.agent" - -# Log every event to /dev/hotplug.log (for debugging). -#SUBSYSTEM!="uids", RUN+="logger.agent" - diff --git a/rules/debian/91-permissions.rules b/rules/debian/91-permissions.rules deleted file mode 100644 index c75b108..0000000 --- a/rules/debian/91-permissions.rules +++ /dev/null @@ -1,124 +0,0 @@ -ACTION=="remove", GOTO="permissions_end" - -# default permissions for block devices -SUBSYSTEM=="block", GROUP="disk" -SUBSYSTEM=="block", ATTRS{removable}=="1", GROUP="floppy" -# the aacraid driver is broken and reports the disks as removable (see #404927) -SUBSYSTEM=="block", DRIVERS=="aacraid", GROUP="disk" -# all block devices on these buses are "removable" -SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394|mmc|pcmcia", GROUP="floppy" - -KERNEL=="cbm", GROUP="floppy" - -# IDE devices -ENV{ID_CDROM}=="?*", GROUP="cdrom" -KERNEL=="ht[0-9]*", GROUP="tape" -KERNEL=="nht[0-9]*", GROUP="tape" - -# SCSI devices -SUBSYSTEM=="scsi_generic|scsi_tape", \ -SUBSYSTEMS=="scsi", ATTRS{type}=="1|8", GROUP="tape" -SUBSYSTEM=="scsi_generic", \ -SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="cdrom" - -# USB devices -KERNEL=="legousbtower*", MODE="0666" -KERNEL=="lp[0-9]*", SUBSYSTEMS=="usb", GROUP="lp" -# hplip and cups 1.4+ use raw USB devices, so permissions should be similar to -# the ones from the old usblp kernel module -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \ - ENV{ID_USB_INTERFACES}=="", IMPORT{program}="usb_id --export %p" -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \ - ENV{ID_USB_INTERFACES}=="*:0701*:", GROUP="lp" - -# usbfs-like devices -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \ - MODE="0664" - -# serial devices -SUBSYSTEM=="tty", GROUP="dialout" -SUBSYSTEM=="capi", GROUP="dialout" -SUBSYSTEM=="slamr", GROUP="dialout" -SUBSYSTEM=="zaptel", GROUP="dialout" -KERNEL=="mISDNtimer", GROUP="dialout" -KERNEL=="mwave", GROUP="dialout" -KERNEL=="hvc*|hvsi*", GROUP="dialout" - -# vc devices (all members of the tty subsystem) -KERNEL=="ptmx", MODE="0666", GROUP="root" -KERNEL=="console", MODE="0600", GROUP="root" -KERNEL=="tty", MODE="0666", GROUP="root" -KERNEL=="tty[0-9]*", GROUP="root" -KERNEL=="pty*", MODE="0666", GROUP="tty" - -# video devices -SUBSYSTEM=="video4linux", GROUP="video" -SUBSYSTEM=="drm", GROUP="video" -SUBSYSTEM=="dvb", GROUP="video" -SUBSYSTEM=="em8300", GROUP="video" -SUBSYSTEM=="graphics", GROUP="video" -SUBSYSTEM=="nvidia", GROUP="video" - -# misc devices -KERNEL=="random", MODE="0666" -KERNEL=="urandom", MODE="0666" -KERNEL=="mem", MODE="0640", GROUP="kmem" -KERNEL=="kmem", MODE="0640", GROUP="kmem" -KERNEL=="port", MODE="0640", GROUP="kmem" -KERNEL=="nvram", MODE="0640", GROUP="kmem" -KERNEL=="full", MODE="0666" -KERNEL=="null", MODE="0666" -KERNEL=="zero", MODE="0666" -KERNEL=="inotify", MODE="0666" -KERNEL=="sonypi", MODE="0666" -KERNEL=="cpu[0-9]*", MODE="0444" -KERNEL=="agpgart", GROUP="video" -KERNEL=="pmu", GROUP="video" -KERNEL=="kqemu", MODE="0666" -KERNEL=="tun", MODE="0666", OPTIONS+="static_node=net/tun" -KERNEL=="rfkill", MODE="0644" - -KERNEL=="cdemu[0-9]*", GROUP="cdrom" -KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" -KERNEL=="pktcdvd", MODE="0644" - -# printers and parallel devices -SUBSYSTEM=="printer", GROUP="lp" -SUBSYSTEM=="ppdev", GROUP="lp" -KERNEL=="irlpt[0-9]*", GROUP="lp" -KERNEL=="pt[0-9]*", GROUP="tape" -KERNEL=="pht[0-9]*", GROUP="tape" - -# sound devices -SUBSYSTEM=="sound", GROUP="audio" - -# ieee1394 devices -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", GROUP="video" -SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", GROUP="video" -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", GROUP="video" -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", GROUP="video" -KERNEL=="raw1394", GROUP="disk" -KERNEL=="dv1394-[0-9]*", GROUP="video" -KERNEL=="video1394-[0-9]*", GROUP="video" - -# input devices -KERNEL=="event[0-9]*", ATTRS{name}=="*dvb*|*DVB*|* IR *", \ - MODE="0664", GROUP="video" -KERNEL=="js[0-9]*", MODE="0664" -KERNEL=="event[0-9]*", ENV{ID_CLASS}=="joystick", \ - MODE="0664", GROUP="audio" -KERNEL=="lirc[0-9]*", GROUP="video" - -KERNEL=="sgi_*", MODE="0666" -KERNEL=="z90crypt", MODE="0666" -KERNEL=="iseries/ibmsis*", GROUP="disk" -KERNEL=="iseries/nvt*", GROUP="disk" -KERNEL=="iseries/vt*", GROUP="disk" -KERNEL=="iseries/vtty*", GROUP="dialout" - -# AOE character devices -SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" -SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440", GROUP="disk" - -LABEL="permissions_end" - diff --git a/rules/misc/30-kernel-compat.rules b/rules/misc/30-kernel-compat.rules index 2a6a97c..7240f9b 100644 --- a/rules/misc/30-kernel-compat.rules +++ b/rules/misc/30-kernel-compat.rules @@ -1,102 +1,12 @@ # do not edit this file, it will be overwritten on update # Rules to support older kernels, which migth miss functionality needed -# for the recent udev version. +# for the recent udev rules. # # This file is used and maintained by Gentoo. -ACTION=="remove", GOTO="kernel_compat_end" - -# -# sysfs timing rules -# - -# needed for kernels <2.6.30 -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", WAIT_FOR="descriptors" - -# -# naming device rules -# - -# dvb device naming -# needed for kernels <2.6.29-rc1 -SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" - -# naming rules for kernels <2.6.31 - -# alsa names -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hwC[D0-9]*", NAME="snd/%k" -KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" - -KERNEL=="mwave", NAME="modems/mwave" - -KERNEL=="mouse*|mice|event*", NAME="input/%k" -KERNEL=="ts[0-9]*|uinput", NAME="input/%k" -KERNEL=="js[0-9]*", NAME="input/%k" - -KERNEL=="card[0-9]*", NAME="dri/%k" - -SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="?*", NAME="dvb/adapter$env{DVB_ADAPTER_NUM}/$env{DVB_DEVICE_TYPE}$env{DVB_DEVICE_NUM}" - -# libusb device nodes -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" - -# printer -SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k" - -# block -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" -KERNEL=="pktcdvd", NAME="pktcdvd/control" - -KERNEL=="rawctl", NAME="raw/rawctl" -SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k" -SUBSYSTEM=="bsg", NAME="bsg/%k" -SUBSYSTEM=="aoe", NAME="etherd/%k" - -# network -KERNEL=="tun", NAME="net/%k" - -# CPU -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" - -# miscellaneous -KERNEL=="auer[0-9]*", NAME="usb/%k" -KERNEL=="hw_random", NAME="hwrng" -KERNEL=="sxctl", NAME="specialix_sxctl" -KERNEL=="rioctl", NAME="specialix_rioctl" -KERNEL=="iowarrior[0-9]*", NAME="usb/%k" -KERNEL=="hiddev[0-9]*", NAME="usb/%k" -KERNEL=="legousbtower[0-9]*", NAME="usb/%k" -KERNEL=="dabusb[0-9]*", NAME="usb/%k" -KERNEL=="usbdpfp[0-9]*", NAME="usb/%k" -KERNEL=="cpad[0-9]*", NAME="usb/%k" - -# end of naming rules for kernel <2.6.31 - - -# -# module loading rules -# ACTION!="add", GOTO="kernel_compat_end" -# No need for more code, as MODALIAS is present -ENV{MODALIAS}=="?*", GOTO="kernel_compat_end" - -# needed for kernel <2.6.30-rc1 -SUBSYSTEM=="scsi", ATTR{type}=="8", RUN+="/sbin/modprobe -b ch" -SUBSYSTEM=="mmc", RUN+="/sbin/modprobe -b mmc_block" - -# needed for kernel <2.6.27-rc5 -# acpi will do on newer kernels -SUBSYSTEM=="pnp", DRIVER!="?*", \ - RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" - # see extras/qemu/42-qemu-usb.rules, version for 2.6.32 + older. ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}="auto" ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}="auto" diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index cd745ef..b31ac42 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -20,6 +20,7 @@ KERNEL=="null|zero|full|random|urandom", MODE="0666" KERNEL=="mem|kmem|port|nvram", GROUP="kmem", MODE="0640" # input +SUBSYSTEM=="input", ENV{ID_INPUT}=="", IMPORT{builtin}="input_id" KERNEL=="mouse*|mice|event*", MODE="0640" KERNEL=="ts[0-9]*|uinput", MODE="0640" KERNEL=="js[0-9]*", MODE="0644" @@ -38,7 +39,8 @@ SUBSYSTEM=="graphics", GROUP="video" SUBSYSTEM=="drm", GROUP="video" # sound -SUBSYSTEM=="sound", GROUP="audio" +SUBSYSTEM=="sound", GROUP="audio", \ + OPTIONS+="static_node=snd/seq", OPTIONS+="static_node=snd/timer" # DVB (video) SUBSYSTEM=="dvb", GROUP="video" @@ -49,20 +51,17 @@ SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", GROUP="video" SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", GROUP="video" SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", GROUP="video" -# libusb device nodes +# 'libusb' device nodes SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id" # printer KERNEL=="parport[0-9]*", GROUP="lp" SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp" SUBSYSTEM=="ppdev", GROUP="lp" -SUBSYSTEM=="usb", KERNEL=="lp*", SYMLINK+="usb%k", GROUP="lp" KERNEL=="lp[0-9]*", GROUP="lp" KERNEL=="irlpt[0-9]*", GROUP="lp" -# hplip and cups 1.4+ use raw USB devices, so permissions should be similar to -# the ones from the old usblp kernel module -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="", IMPORT{program}="usb_id --export %p" -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701*:", GROUP="lp", MODE="0664" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:*", GROUP="lp" # block SUBSYSTEM=="block", GROUP="disk" @@ -71,7 +70,6 @@ SUBSYSTEM=="block", GROUP="disk" SUBSYSTEM=="block", KERNEL=="fd[0-9]", GROUP="floppy" # cdrom -SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n", GROUP="cdrom" SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="cdrom" KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" KERNEL=="pktcdvd", GROUP="cdrom" @@ -98,8 +96,7 @@ KERNEL=="rfkill", MODE="0644" # CPU KERNEL=="cpu[0-9]*", MODE="0444" -KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse", \ - RUN+="/bin/mount -t fusectl fusectl /sys/fs/fuse/connections" +KERNEL=="fuse", ACTION=="add", MODE="0666", OPTIONS+="static_node=fuse" SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc" KERNEL=="mmtimer", MODE="0644" diff --git a/rules/rules.d/60-persistent-alsa.rules b/rules/rules.d/60-persistent-alsa.rules index 39a3652..8154e2d 100644 --- a/rules/rules.d/60-persistent-alsa.rules +++ b/rules/rules.d/60-persistent-alsa.rules @@ -4,12 +4,11 @@ ACTION=="remove", GOTO="persistent_alsa_end" SUBSYSTEM!="sound", GOTO="persistent_alsa_end" KERNEL!="controlC[0-9]*", GOTO="persistent_alsa_end" -SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" -SUBSYSTEMS=="usb", ENV{ID_IFACE}="$attr{bInterfaceNumber}" -ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="?*", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_IFACE}" -ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{builtin}="usb_id" +ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="?*", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_USB_INTERFACE_NUM}" +ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -ENV{ID_PATH}=="", IMPORT{program}="path_id %p" +IMPORT{builtin}="path_id" ENV{ID_PATH}=="?*", SYMLINK+="snd/by-path/$env{ID_PATH}" LABEL="persistent_alsa_end" diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules index 634c4db..fb798dd 100644 --- a/rules/rules.d/60-persistent-input.rules +++ b/rules/rules.d/60-persistent-input.rules @@ -2,10 +2,9 @@ ACTION=="remove", GOTO="persistent_input_end" SUBSYSTEM!="input", GOTO="persistent_input_end" -KERNEL=="input[0-9]*", GOTO="persistent_input_end" +SUBSYSTEMS=="bluetooth", GOTO="persistent_input_end" -ENV{ID_INPUT}=="", IMPORT{program}="input_id %p" -SUBSYSTEMS=="usb", ENV{ID_BUS}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", ENV{ID_BUS}=="", IMPORT{builtin}="usb_id" # determine class name for persistent symlinks ENV{ID_INPUT_KEYBOARD}=="?*", ENV{.INPUT_CLASS}="kbd" @@ -21,13 +20,15 @@ ENV{.INPUT_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" # by-id links KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{.INPUT_CLASS}" +KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", ATTRS{bInterfaceNumber}=="?*", ATTRS{bInterfaceNumber}!="00", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$attr{bInterfaceNumber}-$env{.INPUT_CLASS}" KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{.INPUT_CLASS}" +KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", ATTRS{bInterfaceNumber}=="?*", ATTRS{bInterfaceNumber}!="00", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$attr{bInterfaceNumber}-event-$env{.INPUT_CLASS}" # allow empty class for USB devices, by appending the interface number SUBSYSTEMS=="usb", ENV{ID_BUS}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="", ATTRS{bInterfaceNumber}=="?*", \ SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-if$attr{bInterfaceNumber}" # by-path -SUBSYSTEMS=="pci|usb|platform", IMPORT{program}="path_id %p" +SUBSYSTEMS=="pci|usb|platform|acpi", IMPORT{builtin}="path_id" ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{.INPUT_CLASS}" ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{.INPUT_CLASS}" # allow empty class for platform and usb devices; platform supports only a single interface that way diff --git a/rules/rules.d/60-persistent-serial.rules b/rules/rules.d/60-persistent-serial.rules index 3e1a565..2948200 100644 --- a/rules/rules.d/60-persistent-serial.rules +++ b/rules/rules.d/60-persistent-serial.rules @@ -4,17 +4,17 @@ ACTION=="remove", GOTO="persistent_serial_end" SUBSYSTEM!="tty", GOTO="persistent_serial_end" KERNEL!="ttyUSB[0-9]*|ttyACM[0-9]*", GOTO="persistent_serial_end" -SUBSYSTEMS=="usb-serial", ENV{ID_PORT}="$attr{port_number}" +SUBSYSTEMS=="usb-serial", ENV{.ID_PORT}="$attr{port_number}" -IMPORT="path_id %p" -ENV{ID_PATH}=="?*", ENV{ID_PORT}=="", SYMLINK+="serial/by-path/$env{ID_PATH}" -ENV{ID_PATH}=="?*", ENV{ID_PORT}=="?*", SYMLINK+="serial/by-path/$env{ID_PATH}-port$env{ID_PORT}" +IMPORT{builtin}="path_id" +ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="", SYMLINK+="serial/by-path/$env{ID_PATH}" +ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="?*", SYMLINK+="serial/by-path/$env{ID_PATH}-port$env{.ID_PORT}" -IMPORT="usb_id --export %p" +IMPORT{builtin}="usb_id" ENV{ID_SERIAL}=="", GOTO="persistent_serial_end" -SUBSYSTEMS=="usb", ENV{ID_IFACE}="$attr{bInterfaceNumber}" -ENV{ID_IFACE}=="", GOTO="persistent_serial_end" -ENV{ID_PORT}=="", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_IFACE}" -ENV{ID_PORT}=="?*", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_IFACE}-port$env{ID_PORT}" +SUBSYSTEMS=="usb", ENV{ID_USB_INTERFACE_NUM}="$attr{bInterfaceNumber}" +ENV{ID_USB_INTERFACE_NUM}=="", GOTO="persistent_serial_end" +ENV{.ID_PORT}=="", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_USB_INTERFACE_NUM}" +ENV{.ID_PORT}=="?*", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_USB_INTERFACE_NUM}-port$env{.ID_PORT}" LABEL="persistent_serial_end" diff --git a/rules/rules.d/60-persistent-storage-tape.rules b/rules/rules.d/60-persistent-storage-tape.rules index 6ccd6e5..b1a64ce 100644 --- a/rules/rules.d/60-persistent-storage-tape.rules +++ b/rules/rules.d/60-persistent-storage-tape.rules @@ -5,19 +5,20 @@ ACTION=="remove", GOTO="persistent_storage_tape_end" # type 8 devices are "Medium Changers" -SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d $tempnode", SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" +SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d $tempnode", \ + SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", ENV{.BSG_DEV}="$root/bsg/$id" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", IMPORT="scsi_id --whitelisted --export --device=$env{.BSG_DEV}", ENV{ID_BUS}="scsi" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --whitelisted --export --device=$env{.BSG_DEV}", ENV{ID_BUS}="scsi" KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" # by-path (parent device path) -KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{program}="path_id %p" +KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{builtin}="path_id" KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}-nst" diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 062049c..894b50b 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -7,6 +7,10 @@ ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" ACTION=="remove", GOTO="persistent_storage_end" + +# enable in-kernel media-presence polling +ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}=="0", ATTR{parameters/events_dfl_poll_msecs}="2000" + SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices @@ -22,14 +26,18 @@ ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}" KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n" -# USB devices use their own serial number -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" # ATA devices with their own "ata" kernel subsystem KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $tempnode" # ATA devices using the "scsi" subsystem KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $tempnode" -# ATA/ATAPI devices using the "scsi" subsystem -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", IMPORT{program}="ata_id --export $tempnode" +# ATA/ATAPI devices (SPC-3 or later) using the "scsi" subsystem +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $tempnode" + +# Run ata_id on non-removable USB Mass Storage (SATA/PATA disks in enclosures) +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", ATTR{removable}=="0", SUBSYSTEMS=="usb", IMPORT{program}="ata_id --export $tempnode" +# Otherwise fall back to using usb_id for USB devices +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" + # scsi devices KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" @@ -50,7 +58,7 @@ KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}= KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}-part%n" # by-path (parent device path) -ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT{program}="path_id %p" +ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id" ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" @@ -58,14 +66,14 @@ ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PA ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" # probe filesystem metadata of optical drives which have a media inserted -KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" +KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" # single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET -KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode" +KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode" # probe filesystem metadata of disks KERNEL!="sr*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode" -# watch for future changes +# watch metadata changes by tools closing the device after writing KERNEL!="sr*", OPTIONS+="watch" # by-label/by-uuid links (filesystem metadata) @@ -76,4 +84,8 @@ ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk ENV{DEVTYPE}=="disk", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}" ENV{DEVTYPE}=="partition", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}-part%n" +# by-partlabel/by-partuuid links (partition metadata) +ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-partuuid/$env{ID_PART_ENTRY_UUID}" +ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK+="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}" + LABEL="persistent_storage_end" diff --git a/rules/rules.d/75-net-description.rules b/rules/rules.d/75-net-description.rules index 490fcce..0ffce2c 100644 --- a/rules/rules.d/75-net-description.rules +++ b/rules/rules.d/75-net-description.rules @@ -3,7 +3,7 @@ ACTION=="remove", GOTO="net_end" SUBSYSTEM!="net", GOTO="net_end" -SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{builtin}="usb_id" SUBSYSTEMS=="usb", ENV{ID_MODEL_FROM_DATABASE}=="", IMPORT{program}="usb-db %p" SUBSYSTEMS=="usb", ATTRS{idVendor}!="", ATTRS{idProduct}!="", ENV{ID_VENDOR_ID}="$attr{idVendor}", ENV{ID_MODEL_ID}="$attr{idProduct}" SUBSYSTEMS=="usb", GOTO="net_end" diff --git a/rules/rules.d/75-tty-description.rules b/rules/rules.d/75-tty-description.rules index c2980cf..b67c857 100644 --- a/rules/rules.d/75-tty-description.rules +++ b/rules/rules.d/75-tty-description.rules @@ -3,7 +3,7 @@ ACTION=="remove", GOTO="tty_end" SUBSYSTEM!="tty", GOTO="tty_end" -SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{builtin}="usb_id" SUBSYSTEMS=="usb", ENV{ID_MODEL_FROM_DATABASE}=="", IMPORT{program}="usb-db %p" SUBSYSTEMS=="usb", ATTRS{idVendor}!="", ATTRS{idProduct}!="", ENV{ID_VENDOR_ID}="$attr{idVendor}", ENV{ID_MODEL_ID}="$attr{idProduct}" SUBSYSTEMS=="usb", GOTO="tty_end" diff --git a/rules/rules.d/78-sound-card.rules b/rules/rules.d/78-sound-card.rules index 7b821d4..e3a13b5 100644 --- a/rules/rules.d/78-sound-card.rules +++ b/rules/rules.d/78-sound-card.rules @@ -37,10 +37,8 @@ KERNEL!="card*", GOTO="sound_end" ENV{SOUND_INITIALIZED}="1" -SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" SUBSYSTEMS=="usb", ENV{ID_VENDOR_FROM_DATABASE}=="", IMPORT{program}="usb-db %p" -SUBSYSTEMS=="usb", ATTRS{idVendor}!="", ATTRS{idProduct}!="", ENV{ID_VENDOR_ID}="$attr{idVendor}", ENV{ID_MODEL_ID}="$attr{idProduct}" -SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}!="", ENV{ID_IFACE}="$attr{bInterfaceNumber}" SUBSYSTEMS=="usb", GOTO="skip_pci" SUBSYSTEMS=="pci", ENV{ID_VENDOR_FROM_DATABASE}=="", IMPORT{program}="pci-db %p" @@ -48,10 +46,10 @@ SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_ LABEL="skip_pci" -ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="?*", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_IFACE}-$attr{id}" -ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$attr{id}" +ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="?*", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_USB_INTERFACE_NUM}-$attr{id}" +ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$attr{id}" -ENV{ID_PATH}=="", IMPORT{program}="path_id %p/controlC%n" +IMPORT{builtin}="path_id" # The values used here for $SOUND_FORM_FACTOR and $SOUND_CLASS should be kept # in sync with those defined for PulseAudio's src/pulse/proplist.h diff --git a/rules/rules.d/80-drivers.rules b/rules/rules.d/80-drivers.rules index 04a86bd..cf89735 100644 --- a/rules/rules.d/80-drivers.rules +++ b/rules/rules.d/80-drivers.rules @@ -7,7 +7,6 @@ SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe -bv tifm_sd" SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe -bv tifm_ms" SUBSYSTEM=="memstick", RUN+="/sbin/modprobe -bv --all ms_block mspro_block" SUBSYSTEM=="i2o", RUN+="/sbin/modprobe -bv i2o_block" -SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe -bv sg" SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe -bv ppdev" LABEL="drivers_end" diff --git a/test/rule-syntax-check.py b/test/rule-syntax-check.py index 6cb0215..a94a965 100755 --- a/test/rule-syntax-check.py +++ b/test/rule-syntax-check.py @@ -55,9 +55,9 @@ for path in sys.argv[1:]: if not (no_args_tests.match(clause) or args_tests.match(clause) or no_args_assign.match(clause) or args_assign.match(clause)): - print 'Invalid line %s:%i: %s' % (path, lineno, line) - print ' clause:', clause - print + print('Invalid line %s:%i: %s' % (path, lineno, line)) + print(' clause:', clause) + print() result = 1 break diff --git a/test/udev-test.pl b/test/udev-test.pl index 6a0ea82..f93859c 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -14,7 +14,7 @@ # After creation and removal the result is checked against the # expected value and the result is printed. # -# Copyright (C) 2004-2008 Kay Sievers +# Copyright (C) 2004-2011 Kay Sievers # Copyright (C) 2004 Leann Ogasawara use warnings; @@ -292,7 +292,7 @@ EOF devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node12345678", rules => < "parent", option => "keep", rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", - exp_perms => "0:0:0600", + exp_perms => "0:0:0440", exp_rem_error => "yes", rules => < "builtin path_id", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0", + rules => <$udev_conf" || die "unable to create config file: $udev_conf"; print CONF "udev_root=\"$udev_root\"\n"; +print CONF "udev_run=\"$udev_root/.udev\"\n"; print CONF "udev_rules=\"$PWD\"\n"; print CONF "udev_log=\"err\"\n"; close CONF; diff --git a/udev/sd-daemon.c b/udev/sd-daemon.c index e12fb04..e68b708 100644 --- a/udev/sd-daemon.c +++ b/udev/sd-daemon.c @@ -41,10 +41,27 @@ #include #include #include +#include + +#if defined(__linux__) +#include +#endif #include "sd-daemon.h" -int sd_listen_fds(int unset_environment) { +#if (__GNUC__ >= 4) +#ifdef SD_EXPORT_SYMBOLS +/* Export symbols */ +#define _sd_export_ __attribute__ ((visibility("default"))) +#else +/* Don't export the symbols */ +#define _sd_export_ __attribute__ ((visibility("hidden"))) +#endif +#else +#define _sd_export_ +#endif + +_sd_export_ int sd_listen_fds(int unset_environment) { #if defined(DISABLE_SYSTEMD) || !defined(__linux__) return 0; @@ -125,7 +142,7 @@ finish: #endif } -int sd_is_fifo(int fd, const char *path) { +_sd_export_ int sd_is_fifo(int fd, const char *path) { struct stat st_fd; if (fd < 0) @@ -158,6 +175,42 @@ int sd_is_fifo(int fd, const char *path) { return 1; } +_sd_export_ int sd_is_special(int fd, const char *path) { + struct stat st_fd; + + if (fd < 0) + return -EINVAL; + + if (fstat(fd, &st_fd) < 0) + return -errno; + + if (!S_ISREG(st_fd.st_mode) && !S_ISCHR(st_fd.st_mode)) + return 0; + + if (path) { + struct stat st_path; + + if (stat(path, &st_path) < 0) { + + if (errno == ENOENT || errno == ENOTDIR) + return 0; + + return -errno; + } + + if (S_ISREG(st_fd.st_mode) && S_ISREG(st_path.st_mode)) + return + st_path.st_dev == st_fd.st_dev && + st_path.st_ino == st_fd.st_ino; + else if (S_ISCHR(st_fd.st_mode) && S_ISCHR(st_path.st_mode)) + return st_path.st_rdev == st_fd.st_rdev; + else + return 0; + } + + return 1; +} + static int sd_is_socket_internal(int fd, int type, int listening) { struct stat st_fd; @@ -209,7 +262,7 @@ union sockaddr_union { struct sockaddr_storage storage; }; -int sd_is_socket(int fd, int family, int type, int listening) { +_sd_export_ int sd_is_socket(int fd, int family, int type, int listening) { int r; if (family < 0) @@ -228,7 +281,7 @@ int sd_is_socket(int fd, int family, int type, int listening) { if (getsockname(fd, &sockaddr.sa, &l) < 0) return -errno; - if (l < offsetof(struct sockaddr_un, sun_path)) + if (l < sizeof(sa_family_t)) return -EINVAL; return sockaddr.sa.sa_family == family; @@ -237,7 +290,7 @@ int sd_is_socket(int fd, int family, int type, int listening) { return 1; } -int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) { +_sd_export_ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) { union sockaddr_union sockaddr; socklen_t l; int r; @@ -254,7 +307,7 @@ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port if (getsockname(fd, &sockaddr.sa, &l) < 0) return -errno; - if (l < offsetof(struct sockaddr_un, sun_path)) + if (l < sizeof(sa_family_t)) return -EINVAL; if (sockaddr.sa.sa_family != AF_INET && @@ -282,7 +335,7 @@ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port return 1; } -int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) { +_sd_export_ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) { union sockaddr_union sockaddr; socklen_t l; int r; @@ -296,7 +349,7 @@ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t if (getsockname(fd, &sockaddr.sa, &l) < 0) return -errno; - if (l < offsetof(struct sockaddr_un, sun_path)) + if (l < sizeof(sa_family_t)) return -EINVAL; if (sockaddr.sa.sa_family != AF_UNIX) @@ -325,7 +378,44 @@ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t return 1; } -int sd_notify(int unset_environment, const char *state) { +_sd_export_ int sd_is_mq(int fd, const char *path) { +#if !defined(__linux__) + return 0; +#else + struct mq_attr attr; + + if (fd < 0) + return -EINVAL; + + if (mq_getattr(fd, &attr) < 0) + return -errno; + + if (path) { + char fpath[PATH_MAX]; + struct stat a, b; + + if (path[0] != '/') + return -EINVAL; + + if (fstat(fd, &a) < 0) + return -errno; + + strncpy(stpcpy(fpath, "/dev/mqueue"), path, sizeof(fpath) - 12); + fpath[sizeof(fpath)-1] = 0; + + if (stat(fpath, &b) < 0) + return -errno; + + if (a.st_dev != b.st_dev || + a.st_ino != b.st_ino) + return 0; + } + + return 1; +#endif +} + +_sd_export_ int sd_notify(int unset_environment, const char *state) { #if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC) return 0; #else @@ -393,7 +483,7 @@ finish: #endif } -int sd_notifyf(int unset_environment, const char *format, ...) { +_sd_export_ int sd_notifyf(int unset_environment, const char *format, ...) { #if defined(DISABLE_SYSTEMD) || !defined(__linux__) return 0; #else @@ -415,7 +505,7 @@ int sd_notifyf(int unset_environment, const char *format, ...) { #endif } -int sd_booted(void) { +_sd_export_ int sd_booted(void) { #if defined(DISABLE_SYSTEMD) || !defined(__linux__) return 0; #else diff --git a/udev/sd-daemon.h b/udev/sd-daemon.h index fdf3cc0..46dc7fd 100644 --- a/udev/sd-daemon.h +++ b/udev/sd-daemon.h @@ -75,14 +75,6 @@ extern "C" { #endif #endif -#ifndef _sd_hidden_ -#if (__GNUC__ >= 4) && !defined(SD_EXPORT_SYMBOLS) -#define _sd_hidden_ __attribute__ ((visibility("hidden"))) -#else -#define _sd_hidden_ -#endif -#endif - /* Log levels for usage on stderr: @@ -117,7 +109,7 @@ extern "C" { See sd_listen_fds(3) for more information. */ -int sd_listen_fds(int unset_environment) _sd_hidden_; +int sd_listen_fds(int unset_environment); /* Helper call for identifying a passed file descriptor. Returns 1 if @@ -129,7 +121,19 @@ int sd_listen_fds(int unset_environment) _sd_hidden_; See sd_is_fifo(3) for more information. */ -int sd_is_fifo(int fd, const char *path) _sd_hidden_; +int sd_is_fifo(int fd, const char *path); + +/* + Helper call for identifying a passed file descriptor. Returns 1 if + the file descriptor is a special character device on the file + system stored under the specified path, 0 otherwise. + If path is NULL a path name check will not be done and the call + only verifies if the file descriptor refers to a special character. + Returns a negative errno style error code on failure. + + See sd_is_special(3) for more information. +*/ +int sd_is_special(int fd, const char *path); /* Helper call for identifying a passed file descriptor. Returns 1 if @@ -145,7 +149,7 @@ int sd_is_fifo(int fd, const char *path) _sd_hidden_; See sd_is_socket(3) for more information. */ -int sd_is_socket(int fd, int family, int type, int listening) _sd_hidden_; +int sd_is_socket(int fd, int family, int type, int listening); /* Helper call for identifying a passed file descriptor. Returns 1 if @@ -159,7 +163,7 @@ int sd_is_socket(int fd, int family, int type, int listening) _sd_hidden_; See sd_is_socket_inet(3) for more information. */ -int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) _sd_hidden_; +int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port); /* Helper call for identifying a passed file descriptor. Returns 1 if @@ -175,7 +179,15 @@ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port See sd_is_socket_unix(3) for more information. */ -int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) _sd_hidden_; +int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length); + +/* + Helper call for identifying a passed file descriptor. Returns 1 if + the file descriptor is a POSIX Message Queue of the specified name, + 0 otherwise. If path is NULL a message queue name check is not + done. Returns a negative errno style error code on failure. +*/ +int sd_is_mq(int fd, const char *path); /* Informs systemd about changed daemon state. This takes a number of @@ -185,7 +197,7 @@ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t READY=1 Tells systemd that daemon startup is finished (only relevant for services of Type=notify). The passed argument is a boolean "1" or "0". Since there is - little value in signalling non-readiness the only + little value in signaling non-readiness the only value daemons should send is "READY=1". STATUS=... Passes a single-line status string back to systemd @@ -206,7 +218,7 @@ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t fork off the process itself. Example: "MAINPID=4711" Daemons can choose to send additional variables. However, it is - recommened to prefix variable names not listed above with X_. + recommended to prefix variable names not listed above with X_. Returns a negative errno-style error code on failure. Returns > 0 if systemd could be notified, 0 if it couldn't possibly because @@ -221,7 +233,7 @@ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t See sd_notify(3) for more information. */ -int sd_notify(int unset_environment, const char *state) _sd_hidden_; +int sd_notify(int unset_environment, const char *state); /* Similar to sd_notify() but takes a format string. @@ -243,7 +255,7 @@ int sd_notify(int unset_environment, const char *state) _sd_hidden_; See sd_notifyf(3) for more information. */ -int sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_(2,3) _sd_hidden_; +int sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_(2,3); /* Returns > 0 if the system was booted with systemd. Returns < 0 on @@ -252,11 +264,11 @@ int sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_( fine. You should NOT protect them with a call to this function. Also note that this function checks whether the system, not the user session is controlled by systemd. However the functions above work - for both session and system services. + for both user and system services. See sd_booted(3) for more information. */ -int sd_booted(void) _sd_hidden_; +int sd_booted(void); #ifdef __cplusplus } diff --git a/udev/test-udev.c b/udev/test-udev.c index 28c833a..0771689 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -23,36 +23,24 @@ #include #include #include -#include #include #include #include +#include #include "udev.h" -static void sig_handler(int signum) -{ - switch (signum) { - case SIGALRM: - _exit(1); - case SIGINT: - case SIGTERM: - _exit(20 + signum); - } -} - int main(int argc, char *argv[]) { struct udev *udev; - struct udev_event *event; - struct udev_device *dev; - struct udev_rules *rules; + struct udev_event *event = NULL; + struct udev_device *dev = NULL; + struct udev_rules *rules = NULL; char syspath[UTIL_PATH_SIZE]; const char *devpath; const char *action; const char *subsystem; - struct sigaction act; - sigset_t mask; + sigset_t mask, sigmask_orig; int err = -EINVAL; udev = udev_new(); @@ -61,22 +49,7 @@ int main(int argc, char *argv[]) info(udev, "version %s\n", VERSION); udev_selinux_init(udev); - /* set signal handlers */ - memset(&act, 0x00, sizeof(act)); - act.sa_handler = sig_handler; - sigemptyset (&act.sa_mask); - act.sa_flags = 0; - sigaction(SIGALRM, &act, NULL); - sigaction(SIGINT, &act, NULL); - sigaction(SIGTERM, &act, NULL); - sigemptyset(&mask); - sigaddset(&mask, SIGALRM); - sigaddset(&mask, SIGINT); - sigaddset(&mask, SIGTERM); - sigprocmask(SIG_UNBLOCK, &mask, NULL); - - /* trigger timeout to prevent hanging processes */ - alarm(UDEV_EVENT_TIMEOUT); + sigprocmask(SIG_SETMASK, NULL, &sigmask_orig); action = getenv("ACTION"); devpath = getenv("DEVPATH"); @@ -84,7 +57,7 @@ int main(int argc, char *argv[]) if (action == NULL || subsystem == NULL || devpath == NULL) { err(udev, "action, subsystem or devpath missing\n"); - goto exit; + goto out; } rules = udev_rules_new(udev, 1); @@ -93,7 +66,7 @@ int main(int argc, char *argv[]) dev = udev_device_new_from_syspath(udev, syspath); if (dev == NULL) { info(udev, "unknown device '%s'\n", devpath); - goto fail; + goto out; } /* skip reading of db, but read kernel parameters */ @@ -102,20 +75,24 @@ int main(int argc, char *argv[]) udev_device_set_action(dev, action); event = udev_event_new(dev); - err = udev_event_execute_rules(event, rules); - /* rules may change/disable the timeout */ - if (udev_device_get_event_timeout(dev) >= 0) - alarm(udev_device_get_event_timeout(dev)); + sigfillset(&mask); + sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); + event->fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); + if (event->fd_signal < 0) { + fprintf(stderr, "error creating signalfd\n"); + goto out; + } + err = udev_event_execute_rules(event, rules, &sigmask_orig); if (err == 0) udev_event_execute_run(event, NULL); - +out: + if (event != NULL && event->fd_signal >= 0) + close(event->fd_signal); udev_event_unref(event); udev_device_unref(dev); -fail: udev_rules_unref(rules); -exit: udev_selinux_exit(udev); udev_unref(udev); if (err != 0) diff --git a/udev/udev-builtin-input_id.c b/udev/udev-builtin-input_id.c new file mode 100644 index 0000000..84ca0f7 --- /dev/null +++ b/udev/udev-builtin-input_id.c @@ -0,0 +1,218 @@ +/* + * compose persistent device path + * + * Copyright (C) 2009 Martin Pitt + * Portions Copyright (C) 2004 David Zeuthen, + * Copyright (C) 2011 Kay Sievers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +/* we must use this kernel-compatible implementation */ +#define BITS_PER_LONG (sizeof(unsigned long) * 8) +#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) +#define OFF(x) ((x)%BITS_PER_LONG) +#define BIT(x) (1UL<> OFF(bit)) & 1) + +/* + * Read a capability attribute and return bitmask. + * @param dev udev_device + * @param attr sysfs attribute name (e. g. "capabilities/key") + * @param bitmask: Output array which has a sizeof of bitmask_size + */ +static void get_cap_mask(struct udev_device *dev, + struct udev_device *pdev, const char* attr, + unsigned long *bitmask, size_t bitmask_size, + bool test) +{ + struct udev *udev = udev_device_get_udev(dev); + char text[4096]; + unsigned i; + char* word; + unsigned long val; + + snprintf(text, sizeof(text), "%s", udev_device_get_sysattr_value(pdev, attr)); + info(udev, "%s raw kernel attribute: %s\n", attr, text); + + memset (bitmask, 0, bitmask_size); + i = 0; + while ((word = strrchr(text, ' ')) != NULL) { + val = strtoul (word+1, NULL, 16); + if (i < bitmask_size/sizeof(unsigned long)) + bitmask[i] = val; + else + info(udev, "ignoring %s block %lX which is larger than maximum size\n", attr, val); + *word = '\0'; + ++i; + } + val = strtoul (text, NULL, 16); + if (i < bitmask_size / sizeof(unsigned long)) + bitmask[i] = val; + else + info(udev, "ignoring %s block %lX which is larger than maximum size\n", attr, val); + + if (test) { + /* printf pattern with the right unsigned long number of hex chars */ + snprintf(text, sizeof(text), " bit %%4u: %%0%zilX\n", 2 * sizeof(unsigned long)); + info(udev, "%s decoded bit map:\n", attr); + val = bitmask_size / sizeof (unsigned long); + /* skip over leading zeros */ + while (bitmask[val-1] == 0 && val > 0) + --val; + for (i = 0; i < val; ++i) + info(udev, text, i * BITS_PER_LONG, bitmask[i]); + } +} + +/* pointer devices */ +static void test_pointers (struct udev_device *dev, + const unsigned long* bitmask_ev, + const unsigned long* bitmask_abs, + const unsigned long* bitmask_key, + const unsigned long* bitmask_rel, + bool test) +{ + int is_mouse = 0; + int is_touchpad = 0; + + if (!test_bit (EV_KEY, bitmask_ev)) { + if (test_bit (EV_ABS, bitmask_ev) && + test_bit (ABS_X, bitmask_abs) && + test_bit (ABS_Y, bitmask_abs) && + test_bit (ABS_Z, bitmask_abs)) + udev_builtin_add_property(dev, test, "ID_INPUT_ACCELEROMETER", "1"); + return; + } + + if (test_bit (EV_ABS, bitmask_ev) && + test_bit (ABS_X, bitmask_abs) && test_bit (ABS_Y, bitmask_abs)) { + if (test_bit (BTN_STYLUS, bitmask_key) || test_bit (BTN_TOOL_PEN, bitmask_key)) + udev_builtin_add_property(dev, test, "ID_INPUT_TABLET", "1"); + else if (test_bit (BTN_TOOL_FINGER, bitmask_key) && !test_bit (BTN_TOOL_PEN, bitmask_key)) + is_touchpad = 1; + else if (test_bit (BTN_TRIGGER, bitmask_key) || + test_bit (BTN_A, bitmask_key) || + test_bit (BTN_1, bitmask_key)) + udev_builtin_add_property(dev, test, "ID_INPUT_JOYSTICK", "1"); + else if (test_bit (BTN_MOUSE, bitmask_key)) + /* This path is taken by VMware's USB mouse, which has + * absolute axes, but no touch/pressure button. */ + is_mouse = 1; + else if (test_bit (BTN_TOUCH, bitmask_key)) + udev_builtin_add_property(dev, test, "ID_INPUT_TOUCHSCREEN", "1"); + } + + if (test_bit (EV_REL, bitmask_ev) && + test_bit (REL_X, bitmask_rel) && test_bit (REL_Y, bitmask_rel) && + test_bit (BTN_MOUSE, bitmask_key)) + is_mouse = 1; + + if (is_mouse) + udev_builtin_add_property(dev, test, "ID_INPUT_MOUSE", "1"); + if (is_touchpad) + udev_builtin_add_property(dev, test, "ID_INPUT_TOUCHPAD", "1"); +} + +/* key like devices */ +static void test_key (struct udev_device *dev, + const unsigned long* bitmask_ev, + const unsigned long* bitmask_key, + bool test) +{ + struct udev *udev = udev_device_get_udev(dev); + unsigned i; + unsigned long found; + unsigned long mask; + + /* do we have any KEY_* capability? */ + if (!test_bit (EV_KEY, bitmask_ev)) { + info(udev, "test_key: no EV_KEY capability\n"); + return; + } + + /* only consider KEY_* here, not BTN_* */ + found = 0; + for (i = 0; i < BTN_MISC/BITS_PER_LONG; ++i) { + found |= bitmask_key[i]; + info(udev, "test_key: checking bit block %lu for any keys; found=%i\n", i*BITS_PER_LONG, found > 0); + } + /* If there are no keys in the lower block, check the higher block */ + if (!found) { + for (i = KEY_OK; i < BTN_TRIGGER_HAPPY; ++i) { + if (test_bit (i, bitmask_key)) { + info(udev, "test_key: Found key %x in high block\n", i); + found = 1; + break; + } + } + } + + if (found > 0) + udev_builtin_add_property(dev, test, "ID_INPUT_KEY", "1"); + + /* the first 32 bits are ESC, numbers, and Q to D; if we have all of + * those, consider it a full keyboard; do not test KEY_RESERVED, though */ + mask = 0xFFFFFFFE; + if ((bitmask_key[0] & mask) == mask) + udev_builtin_add_property(dev, test, "ID_INPUT_KEYBOARD", "1"); +} + +static int builtin_input_id(struct udev_device *dev, bool test) +{ + struct udev_device *pdev; + unsigned long bitmask_ev[NBITS(EV_MAX)]; + unsigned long bitmask_abs[NBITS(ABS_MAX)]; + unsigned long bitmask_key[NBITS(KEY_MAX)]; + unsigned long bitmask_rel[NBITS(REL_MAX)]; + + /* walk up the parental chain until we find the real input device; the + * argument is very likely a subdevice of this, like eventN */ + pdev = dev; + while (pdev != NULL && udev_device_get_sysattr_value(pdev, "capabilities/ev") == NULL) + pdev = udev_device_get_parent_with_subsystem_devtype(pdev, "input", NULL); + + /* not an "input" class device */ + if (pdev == NULL) + return EXIT_SUCCESS; + + /* Use this as a flag that input devices were detected, so that this + * program doesn't need to be called more than once per device */ + udev_builtin_add_property(dev, test, "ID_INPUT", "1"); + get_cap_mask(dev, pdev, "capabilities/ev", bitmask_ev, sizeof(bitmask_ev), test); + get_cap_mask(dev, pdev, "capabilities/abs", bitmask_abs, sizeof(bitmask_abs), test); + get_cap_mask(dev, pdev, "capabilities/rel", bitmask_rel, sizeof(bitmask_rel), test); + get_cap_mask(dev, pdev, "capabilities/key", bitmask_key, sizeof(bitmask_key), test); + test_pointers(dev, bitmask_ev, bitmask_abs, bitmask_key, bitmask_rel, test); + test_key(dev, bitmask_ev, bitmask_key, test); + return EXIT_SUCCESS; +} + +const struct udev_builtin udev_builtin_input_id = { + .name = "input_id", + .cmd = builtin_input_id, + .help = "input device properties", +}; diff --git a/extras/path_id/path_id.c b/udev/udev-builtin-path_id.c similarity index 73% rename from extras/path_id/path_id.c rename to udev/udev-builtin-path_id.c index c19bfd0..61c50d7 100644 --- a/extras/path_id/path_id.c +++ b/udev/udev-builtin-path_id.c @@ -1,7 +1,7 @@ /* * compose persistent device path * - * Copyright (C) 2009 Kay Sievers + * Copyright (C) 2009-2011 Kay Sievers * * Logic based on Hannes Reinecke's shell script. * @@ -30,49 +30,49 @@ #include #include -#include "libudev.h" -#include "libudev-private.h" - -static int debug; - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - if (debug) { - fprintf(stderr, "%s: ", fn != NULL ? fn : file); - vfprintf(stderr, format, args); - } else { - vsyslog(priority, format, args); - } -} +#include "udev.h" static int path_prepend(char **path, const char *fmt, ...) { va_list va; - char *old; char *pre; - int err; - - old = *path; + int err = 0; va_start(va, fmt); err = vasprintf(&pre, fmt, va); va_end(va); if (err < 0) - return err; + goto out; - if (old != NULL) { - err = asprintf(path, "%s-%s", pre, old); - if (err < 0) - return err; + if (*path != NULL) { + char *new; + + err = asprintf(&new, "%s-%s", pre, *path); free(pre); + if (err < 0) + goto out; + free(*path); + *path = new; } else { *path = pre; } +out: + return err; +} - free(old); - return 0; +/* +** Linux only supports 32 bit luns. +** See drivers/scsi/scsi_scan.c::scsilun_to_int() for more details. +*/ +static int format_lun_number(struct udev_device *dev, char **path) +{ + unsigned long lun = strtoul(udev_device_get_sysnum(dev), NULL, 10); + + /* address method 0, peripheral device addressing with bus id of zero */ + if (lun < 256) + return path_prepend(path, "lun-%d", lun); + /* handle all other lun addressing methods by using a variant of the original lun format */ + return path_prepend(path, "lun-0x%04x%04x00000000", (lun & 0xffff), (lun >> 16) & 0xffff); } static struct udev_device *skip_subsystem(struct udev_device *dev, const char *subsys) @@ -97,7 +97,7 @@ static struct udev_device *handle_scsi_fibre_channel(struct udev_device *parent, struct udev_device *targetdev; struct udev_device *fcdev = NULL; const char *port; - unsigned int lun; + char *lun = NULL;; targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); if (targetdev == NULL) @@ -112,8 +112,10 @@ static struct udev_device *handle_scsi_fibre_channel(struct udev_device *parent, goto out; } - lun = strtoul(udev_device_get_sysnum(parent), NULL, 10); - path_prepend(path, "fc-%s:0x%04x%04x00000000", port, lun & 0xffff, (lun >> 16) & 0xffff); + format_lun_number(parent, &lun); + path_prepend(path, "fc-%s-%s", port, lun); + if (lun) + free(lun); out: udev_device_unref(fcdev); return parent; @@ -121,7 +123,39 @@ out: static struct udev_device *handle_scsi_sas(struct udev_device *parent, char **path) { - return NULL; + struct udev *udev = udev_device_get_udev(parent); + struct udev_device *targetdev; + struct udev_device *target_parent; + struct udev_device *sasdev; + const char *sas_address; + char *lun = NULL; + + targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); + if (targetdev == NULL) + return NULL; + + target_parent = udev_device_get_parent(targetdev); + if (target_parent == NULL) + return NULL; + + sasdev = udev_device_new_from_subsystem_sysname(udev, "sas_device", + udev_device_get_sysname(target_parent)); + if (sasdev == NULL) + return NULL; + + sas_address = udev_device_get_sysattr_value(sasdev, "sas_address"); + if (sas_address == NULL) { + parent = NULL; + goto out; + } + + format_lun_number(parent, &lun); + path_prepend(path, "sas-%s-%s", sas_address, lun); + if (lun) + free(lun); +out: + udev_device_unref(sasdev); + return parent; } static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char **path) @@ -134,18 +168,17 @@ static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char ** struct udev_device *conndev = NULL; const char *addr; const char *port; + char *lun = NULL; /* find iscsi session */ transportdev = parent; - while (1) { + for (;;) { transportdev = udev_device_get_parent(transportdev); if (transportdev == NULL) return NULL; if (strncmp(udev_device_get_sysname(transportdev), "session", 7) == 0) break; } - if (transportdev == NULL) - return NULL; /* find iscsi session device */ sessiondev = udev_device_new_from_subsystem_sysname(udev, "iscsi_session", udev_device_get_sysname(transportdev)); @@ -174,7 +207,10 @@ static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char ** goto out; } - path_prepend(path, "ip-%s:%s-iscsi-%s-lun-%s", addr, port, target, udev_device_get_sysnum(parent)); + format_lun_number(parent, &lun); + path_prepend(path, "ip-%s:%s-iscsi-%s-%s", addr, port, target, lun); + if (lun) + free(lun); out: udev_device_unref(sessiondev); udev_device_unref(conndev); @@ -286,15 +322,19 @@ out: return parent; } -static void handle_scsi_tape(struct udev_device *dev, char **suffix) +static void handle_scsi_tape(struct udev_device *dev, char **path) { const char *name; + /* must be the last device in the syspath */ + if (*path != NULL) + return; + name = udev_device_get_sysname(dev); if (strncmp(name, "nst", 3) == 0 && strchr("lma", name[3]) != NULL) - asprintf(suffix, "nst%c", name[3]); + path_prepend(path, "nst%c", name[3]); else if (strncmp(name, "st", 2) == 0 && strchr("lma", name[2]) != NULL) - asprintf(suffix, "st%c", name[2]); + path_prepend(path, "st%c", name[2]); } static struct udev_device *handle_usb(struct udev_device *parent, char **path) @@ -304,7 +344,9 @@ static struct udev_device *handle_usb(struct udev_device *parent, char **path) const char *port; devtype = udev_device_get_devtype(parent); - if (devtype == NULL || strcmp(devtype, "usb_interface") != 0) + if (devtype == NULL) + return parent; + if (strcmp(devtype, "usb_interface") != 0 && strcmp(devtype, "usb_device") != 0) return parent; str = udev_device_get_sysname(parent); @@ -348,69 +390,10 @@ out: return parent; } -int main(int argc, char **argv) +static int builtin_path_id(struct udev_device *dev, bool test) { - static const struct option options[] = { - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - struct udev *udev; - struct udev_device *dev; struct udev_device *parent; - char syspath[UTIL_PATH_SIZE]; - const char *devpath; - char *path; - char *path_suffix; - int rc = 1; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("path_id"); - udev_set_log_fn(udev, log_fn); - - while (1) { - int option; - - option = getopt_long(argc, argv, "dh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'd': - debug = 1; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'h': - printf("Usage: path_id [--debug] [--help] \n" - " --debug print debug information\n" - " --help print this help text\n\n"); - default: - rc = 1; - goto exit; - } - } - - devpath = argv[optind]; - if (devpath == NULL) { - fprintf(stderr, "No device specified\n"); - rc = 2; - goto exit; - } - - util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); - dev = udev_device_new_from_syspath(udev, syspath); - if (dev == NULL) { - fprintf(stderr, "unable to access '%s'\n", devpath); - rc = 3; - goto exit; - } - - path = NULL; - path_suffix = NULL; + char *path = NULL; /* S390 ccw bus */ parent = udev_device_get_parent_with_subsystem_devtype(dev, "ccw", NULL); @@ -425,11 +408,10 @@ int main(int argc, char **argv) const char *subsys; subsys = udev_device_get_subsystem(parent); - if (subsys == NULL) { ; } else if (strcmp(subsys, "scsi_tape") == 0) { - handle_scsi_tape(parent, &path_suffix); + handle_scsi_tape(parent, &path); } else if (strcmp(subsys, "scsi") == 0) { parent = handle_scsi(parent, &path); } else if (strcmp(subsys, "cciss") == 0) { @@ -445,6 +427,9 @@ int main(int argc, char **argv) } else if (strcmp(subsys, "platform") == 0) { path_prepend(&path, "platform-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "platform"); + } else if (strcmp(subsys, "acpi") == 0) { + path_prepend(&path, "acpi-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "acpi"); } else if (strcmp(subsys, "xen") == 0) { path_prepend(&path, "xen-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "xen"); @@ -457,19 +442,45 @@ int main(int argc, char **argv) } out: if (path != NULL) { - if (path_suffix != NULL) { - printf("ID_PATH=%s%s\n", path, path_suffix); - free(path_suffix); - } else { - printf("ID_PATH=%s\n", path); + char tag[UTIL_NAME_SIZE]; + size_t i; + const char *p; + + /* compose valid udev tag name */ + for (p = path, i = 0; *p; p++) { + if ((*p >= '0' && *p <= '9') || + (*p >= 'A' && *p <= 'Z') || + (*p >= 'a' && *p <= 'z') || + *p == '-') { + tag[i++] = *p; + continue; + } + + /* skip all leading '_' */ + if (i == 0) + continue; + + /* avoid second '_' */ + if (tag[i-1] == '_') + continue; + + tag[i++] = '_'; } + /* strip trailing '_' */ + while (i > 0 && tag[i-1] == '_') + i--; + tag[i] = '\0'; + + udev_builtin_add_property(dev, test, "ID_PATH", path); + udev_builtin_add_property(dev, test, "ID_PATH_TAG", tag); free(path); - rc = 0; + return EXIT_SUCCESS; } - - udev_device_unref(dev); -exit: - udev_unref(udev); - udev_log_close(); - return rc; + return EXIT_FAILURE; } + +const struct udev_builtin udev_builtin_path_id = { + .name = "path_id", + .cmd = builtin_path_id, + .help = "compose persistent device path", +}; diff --git a/extras/usb_id/usb_id.c b/udev/udev-builtin-usb_id.c similarity index 65% rename from extras/usb_id/usb_id.c rename to udev/udev-builtin-usb_id.c index fabd092..587c216 100644 --- a/extras/usb_id/usb_id.c +++ b/udev/udev-builtin-usb_id.c @@ -1,9 +1,10 @@ /* - * usb_id - identify an USB device + * USB device properties and persistent device path * * Copyright (c) 2005 SUSE Linux Products GmbH, Germany + * Author: Hannes Reinecke * - * Author: Hannes Reinecke + * Copyright (C) 2005-2011 Kay Sievers * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,41 +28,8 @@ #include #include #include -#include -#include "libudev.h" -#include "libudev-private.h" - -int debug; - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - if (debug) { - fprintf(stderr, "%s: ", fn != NULL ? fn : file); - vfprintf(stderr, format, args); - } else { - vsyslog(priority, format, args); - } -} - -static char vendor_str[64]; -static char vendor_str_enc[256]; -static const char *vendor_id = ""; -static char model_str[64]; -static char model_str_enc[256]; -static const char *product_id = ""; -static char serial_str[UTIL_NAME_SIZE]; -static char packed_if_str[UTIL_NAME_SIZE]; -static char revision_str[64]; -static char type_str[64]; -static char instance_str[64]; -static const char *ifnum; -static const char *driver; - -static int use_usb_info; -static int use_num_info; +#include "udev.h" static void set_usb_iftype(char *to, int if_class_num, size_t len) { @@ -205,7 +173,7 @@ static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len err = -1; goto out; } - fd = open(filename, O_RDONLY); + fd = open(filename, O_RDONLY|O_CLOEXEC); if (fd < 0) { fprintf(stderr, "error opening USB device 'descriptors' file\n"); err = -1; @@ -220,7 +188,8 @@ static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len pos = 0; strpos = 0; - while (pos < sizeof(buf) && strpos+7 < len) { + ifs_str[0] = '\0'; + while (pos < sizeof(buf) && strpos+7 < len-2) { struct usb_interface_descriptor *desc; char if_str[8]; @@ -232,7 +201,7 @@ static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len if (desc->bDescriptorType != USB_DT_INTERFACE) continue; - if (snprintf(if_str, 8, "%02x%02x%02x:", + if (snprintf(if_str, 8, ":%02x%02x%02x", desc->bInterfaceClass, desc->bInterfaceSubClass, desc->bInterfaceProtocol) != 7) @@ -244,6 +213,10 @@ static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len memcpy(&ifs_str[strpos], if_str, 8), strpos += 7; } + if (strpos > 0) { + ifs_str[strpos++] = ':'; + ifs_str[strpos++] = '\0'; + } out: free(filename); return err; @@ -266,14 +239,39 @@ out: * 6.) If the device supplies a serial number, this number * is concatenated with the identification with an underscore '_'. */ -static int usb_id(struct udev_device *dev) +static int builtin_usb_id(struct udev_device *dev, bool test) { + char vendor_str[64]; + char vendor_str_enc[256]; + const char *vendor_id; + char model_str[64]; + char model_str_enc[256]; + const char *product_id; + char serial_str[UTIL_NAME_SIZE]; + char packed_if_str[UTIL_NAME_SIZE]; + char revision_str[64]; + char type_str[64]; + char instance_str[64]; + const char *ifnum = NULL; + const char *driver = NULL; + char serial[256]; + struct udev *udev = udev_device_get_udev(dev); struct udev_device *dev_interface = NULL; struct udev_device *dev_usb = NULL; const char *if_class, *if_subclass; int if_class_num; int protocol = 0; + size_t l; + char *s; + + vendor_str[0] = '\0'; + model_str[0] = '\0'; + serial_str[0] = '\0'; + packed_if_str[0] = '\0'; + revision_str[0] = '\0'; + type_str[0] = '\0'; + instance_str[0] = '\0'; dbg(udev, "syspath %s\n", udev_device_get_syspath(dev)); @@ -289,7 +287,7 @@ static int usb_id(struct udev_device *dev) if (dev_interface == NULL) { info(udev, "unable to access usb_interface device of '%s'\n", udev_device_get_syspath(dev)); - return 1; + return EXIT_FAILURE; } ifnum = udev_device_get_sysattr_value(dev_interface, "bInterfaceNumber"); @@ -299,7 +297,7 @@ static int usb_id(struct udev_device *dev) if (!if_class) { info(udev, "%s: cannot get bInterfaceClass attribute\n", udev_device_get_sysname(dev)); - return 1; + return EXIT_FAILURE; } if_class_num = strtoul(if_class, NULL, 16); @@ -320,14 +318,14 @@ static int usb_id(struct udev_device *dev) if (!dev_usb) { info(udev, "unable to find parent 'usb' device of '%s'\n", udev_device_get_syspath(dev)); - return 1; + return EXIT_FAILURE; } /* all interfaces of the device in a single string */ dev_if_packed_info(dev_usb, packed_if_str, sizeof(packed_if_str)); /* mass storage : SCSI or ATAPI */ - if ((protocol == 6 || protocol == 2) && !use_usb_info) { + if ((protocol == 6 || protocol == 2)) { struct udev_device *dev_scsi; const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; int host, bus, target, lun; @@ -352,8 +350,8 @@ static int usb_id(struct udev_device *dev) goto fallback; } udev_util_encode_string(scsi_vendor, vendor_str_enc, sizeof(vendor_str_enc)); - udev_util_replace_whitespace(scsi_vendor, vendor_str, sizeof(vendor_str)-1); - udev_util_replace_chars(vendor_str, NULL); + util_replace_whitespace(scsi_vendor, vendor_str, sizeof(vendor_str)-1); + util_replace_chars(vendor_str, NULL); scsi_model = udev_device_get_sysattr_value(dev_scsi, "model"); if (!scsi_model) { @@ -362,8 +360,8 @@ static int usb_id(struct udev_device *dev) goto fallback; } udev_util_encode_string(scsi_model, model_str_enc, sizeof(model_str_enc)); - udev_util_replace_whitespace(scsi_model, model_str, sizeof(model_str)-1); - udev_util_replace_chars(model_str, NULL); + util_replace_whitespace(scsi_model, model_str, sizeof(model_str)-1); + util_replace_chars(model_str, NULL); scsi_type = udev_device_get_sysattr_value(dev_scsi, "type"); if (!scsi_type) { @@ -379,8 +377,8 @@ static int usb_id(struct udev_device *dev) udev_device_get_sysname(dev_scsi)); goto fallback; } - udev_util_replace_whitespace(scsi_rev, revision_str, sizeof(revision_str)-1); - udev_util_replace_chars(revision_str, NULL); + util_replace_whitespace(scsi_rev, revision_str, sizeof(revision_str)-1); + util_replace_chars(revision_str, NULL); /* * some broken devices have the same identifiers @@ -397,37 +395,31 @@ fallback: if (vendor_str[0] == '\0') { const char *usb_vendor = NULL; - if (!use_num_info) - usb_vendor = udev_device_get_sysattr_value(dev_usb, "manufacturer"); - + usb_vendor = udev_device_get_sysattr_value(dev_usb, "manufacturer"); if (!usb_vendor) usb_vendor = vendor_id; - if (!usb_vendor) { info(udev, "No USB vendor information available\n"); - return 1; + return EXIT_FAILURE; } udev_util_encode_string(usb_vendor, vendor_str_enc, sizeof(vendor_str_enc)); - udev_util_replace_whitespace(usb_vendor, vendor_str, sizeof(vendor_str)-1); - udev_util_replace_chars(vendor_str, NULL); + util_replace_whitespace(usb_vendor, vendor_str, sizeof(vendor_str)-1); + util_replace_chars(vendor_str, NULL); } if (model_str[0] == '\0') { const char *usb_model = NULL; - if (!use_num_info) - usb_model = udev_device_get_sysattr_value(dev_usb, "product"); - + usb_model = udev_device_get_sysattr_value(dev_usb, "product"); if (!usb_model) usb_model = product_id; - if (!usb_model) { dbg(udev, "No USB model information available\n"); - return 1; + return EXIT_FAILURE; } udev_util_encode_string(usb_model, model_str_enc, sizeof(model_str_enc)); - udev_util_replace_whitespace(usb_model, model_str, sizeof(model_str)-1); - udev_util_replace_chars(model_str, NULL); + util_replace_whitespace(usb_model, model_str, sizeof(model_str)-1); + util_replace_chars(model_str, NULL); } if (revision_str[0] == '\0') { @@ -435,8 +427,8 @@ fallback: usb_rev = udev_device_get_sysattr_value(dev_usb, "bcdDevice"); if (usb_rev) { - udev_util_replace_whitespace(usb_rev, revision_str, sizeof(revision_str)-1); - udev_util_replace_chars(revision_str, NULL); + util_replace_whitespace(usb_rev, revision_str, sizeof(revision_str)-1); + util_replace_chars(revision_str, NULL); } } @@ -445,134 +437,45 @@ fallback: usb_serial = udev_device_get_sysattr_value(dev_usb, "serial"); if (usb_serial) { - udev_util_replace_whitespace(usb_serial, serial_str, sizeof(serial_str)-1); - udev_util_replace_chars(serial_str, NULL); + util_replace_whitespace(usb_serial, serial_str, sizeof(serial_str)-1); + util_replace_chars(serial_str, NULL); } } - return 0; -} - -int main(int argc, char **argv) -{ - static const struct option options[] = { - { "usb-info", no_argument, NULL, 'u' }, - { "num-info", no_argument, NULL, 'n' }, - { "export", no_argument, NULL, 'x' }, - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - struct udev *udev; - struct udev_device *dev = NULL; - static int export; - int retval = 0; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("usb_id"); - udev_set_log_fn(udev, log_fn); - - while (1) { - int option; - - option = getopt_long(argc, argv, "dnuxh", options, NULL); - if (option == -1) - break; - switch (option) { - case 'd': - debug = 1; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'n': - use_num_info = 1; - use_usb_info = 1; - break; - case 'u': - use_usb_info = 1; - break; - case 'x': - export = 1; - break; - case 'h': - printf("Usage: usb_id [--usb-info] [--num-info] [--export] [--help] []\n" - " --usb-info use usb strings instead\n" - " --num-info use numerical values\n" - " --export print values as environment keys\n" - " --help print this help text\n\n"); - default: - retval = 1; - goto exit; - } - } - - dev = udev_device_new_from_environment(udev); - if (dev == NULL) { - char syspath[UTIL_PATH_SIZE]; - const char *devpath; - - devpath = argv[optind]; - if (devpath == NULL) { - fprintf(stderr, "missing device\n"); - retval = 1; - goto exit; - } - - util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); - dev = udev_device_new_from_syspath(udev, syspath); - if (dev == NULL) { - err(udev, "unable to access '%s'\n", devpath); - retval = 1; - goto exit; - return 1; - } - } - - retval = usb_id(dev); - if (retval == 0) { - char serial[256]; - size_t l; - char *s; - - s = serial; - l = util_strpcpyl(&s, sizeof(serial), vendor_str, "_", model_str, NULL); - if (serial_str[0] != '\0') - l = util_strpcpyl(&s, l, "_", serial_str, NULL); - if (instance_str[0] != '\0') - util_strpcpyl(&s, l, "-", instance_str, NULL); - - if (export) { - printf("ID_VENDOR=%s\n", vendor_str); - printf("ID_VENDOR_ENC=%s\n", vendor_str_enc); - printf("ID_VENDOR_ID=%s\n", vendor_id); - printf("ID_MODEL=%s\n", model_str); - printf("ID_MODEL_ENC=%s\n", model_str_enc); - printf("ID_MODEL_ID=%s\n", product_id); - printf("ID_REVISION=%s\n", revision_str); - printf("ID_SERIAL=%s\n", serial); - if (serial_str[0] != '\0') - printf("ID_SERIAL_SHORT=%s\n", serial_str); - if (type_str[0] != '\0') - printf("ID_TYPE=%s\n", type_str); - if (instance_str[0] != '\0') - printf("ID_INSTANCE=%s\n", instance_str); - printf("ID_BUS=usb\n"); - if (packed_if_str[0] != '\0') - printf("ID_USB_INTERFACES=:%s\n", packed_if_str); - if (ifnum != NULL) - printf("ID_USB_INTERFACE_NUM=%s\n", ifnum); - if (driver != NULL) - printf("ID_USB_DRIVER=%s\n", driver); - } else - printf("%s\n", serial); - } - -exit: - udev_device_unref(dev); - udev_unref(udev); - udev_log_close(); - return retval; + s = serial; + l = util_strpcpyl(&s, sizeof(serial), vendor_str, "_", model_str, NULL); + if (serial_str[0] != '\0') + l = util_strpcpyl(&s, l, "_", serial_str, NULL); + + if (instance_str[0] != '\0') + util_strpcpyl(&s, l, "-", instance_str, NULL); + + udev_builtin_add_property(dev, test, "ID_VENDOR", vendor_str); + udev_builtin_add_property(dev, test, "ID_VENDOR_ENC", vendor_str_enc); + udev_builtin_add_property(dev, test, "ID_VENDOR_ID", vendor_id); + udev_builtin_add_property(dev, test, "ID_MODEL", model_str); + udev_builtin_add_property(dev, test, "ID_MODEL_ENC", model_str_enc); + udev_builtin_add_property(dev, test, "ID_MODEL_ID", product_id); + udev_builtin_add_property(dev, test, "ID_REVISION", revision_str); + udev_builtin_add_property(dev, test, "ID_SERIAL", serial); + if (serial_str[0] != '\0') + udev_builtin_add_property(dev, test, "ID_SERIAL_SHORT", serial_str); + if (type_str[0] != '\0') + udev_builtin_add_property(dev, test, "ID_TYPE", type_str); + if (instance_str[0] != '\0') + udev_builtin_add_property(dev, test, "ID_INSTANCE", instance_str); + udev_builtin_add_property(dev, test, "ID_BUS", "usb"); + if (packed_if_str[0] != '\0') + udev_builtin_add_property(dev, test, "ID_USB_INTERFACES", packed_if_str); + if (ifnum != NULL) + udev_builtin_add_property(dev, test, "ID_USB_INTERFACE_NUM", ifnum); + if (driver != NULL) + udev_builtin_add_property(dev, test, "ID_USB_DRIVER", driver); + return EXIT_SUCCESS; } + +const struct udev_builtin udev_builtin_usb_id = { + .name = "usb_id", + .cmd = builtin_usb_id, + .help = "usb device properties", +}; diff --git a/udev/udev-builtin.c b/udev/udev-builtin.c new file mode 100644 index 0000000..eeec6e9 --- /dev/null +++ b/udev/udev-builtin.c @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2007-2009 Kay Sievers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static const struct udev_builtin *builtins[] = { + [UDEV_BUILTIN_PATH_ID] = &udev_builtin_path_id, + [UDEV_BUILTIN_USB_ID] = &udev_builtin_usb_id, + [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, +}; + +int udev_builtin_list(struct udev *udev) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(builtins); i++) + fprintf(stderr, " %-12s %s\n", builtins[i]->name, builtins[i]->help); + return 0; +} + +const char *udev_builtin_name(enum udev_builtin_cmd cmd) +{ + return builtins[cmd]->name; +} + +enum udev_builtin_cmd udev_builtin_lookup(const char *name) +{ + enum udev_builtin_cmd i; + + for (i = 0; i < ARRAY_SIZE(builtins); i++) + if (strcmp(builtins[i]->name, name) == 0) + return i; + return UDEV_BUILTIN_MAX; +} + +int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, bool test) +{ + return builtins[cmd]->cmd(dev, test); +} + +int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val, ...) +{ + struct udev_list_entry *entry; + + entry = udev_device_add_property(dev, key, val); + /* store in db, skip private keys */ + if (key[0] != '.') + udev_list_entry_set_num(entry, true); + + info(udev_device_get_udev(dev), "%s=%s\n", key, val); + if (test) + printf("%s=%s\n", key, val); + return 0; +} diff --git a/udev/udev-ctrl.c b/udev/udev-ctrl.c new file mode 100644 index 0000000..e4348c3 --- /dev/null +++ b/udev/udev-ctrl.c @@ -0,0 +1,494 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +/* wire protocol magic must match */ +#define UDEV_CTRL_MAGIC 0xdead1dea + +enum udev_ctrl_msg_type { + UDEV_CTRL_UNKNOWN, + UDEV_CTRL_SET_LOG_LEVEL, + UDEV_CTRL_STOP_EXEC_QUEUE, + UDEV_CTRL_START_EXEC_QUEUE, + UDEV_CTRL_RELOAD_RULES, + UDEV_CTRL_SET_ENV, + UDEV_CTRL_SET_CHILDREN_MAX, + UDEV_CTRL_PING, + UDEV_CTRL_EXIT, +}; + +struct udev_ctrl_msg_wire { + char version[16]; + unsigned int magic; + enum udev_ctrl_msg_type type; + union { + int intval; + char buf[256]; + }; +}; + +struct udev_ctrl_msg { + int refcount; + struct udev_ctrl_connection *conn; + struct udev_ctrl_msg_wire ctrl_msg_wire; +}; + +struct udev_ctrl { + int refcount; + struct udev *udev; + int sock; + struct sockaddr_un saddr; + socklen_t addrlen; + bool bound; + bool cleanup_socket; + bool connected; +}; + +struct udev_ctrl_connection { + int refcount; + struct udev_ctrl *uctrl; + int sock; +}; + +struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) +{ + struct udev_ctrl *uctrl; + + uctrl = calloc(1, sizeof(struct udev_ctrl)); + if (uctrl == NULL) + return NULL; + uctrl->refcount = 1; + uctrl->udev = udev; + + if (fd < 0) { + uctrl->sock = socket(AF_LOCAL, SOCK_SEQPACKET|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); + if (uctrl->sock < 0) { + err(udev, "error getting socket: %m\n"); + udev_ctrl_unref(uctrl); + return NULL; + } + } else { + uctrl->bound = true; + uctrl->sock = fd; + } + + uctrl->saddr.sun_family = AF_LOCAL; + util_strscpyl(uctrl->saddr.sun_path, sizeof(uctrl->saddr.sun_path), + udev_get_run_path(udev), "/control", NULL); + uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); + return uctrl; +} + +struct udev_ctrl *udev_ctrl_new(struct udev *udev) +{ + return udev_ctrl_new_from_fd(udev, -1); +} + +int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) +{ + int err; + + if (!uctrl->bound) { + err = bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + if (err < 0 && errno == EADDRINUSE) { + unlink(uctrl->saddr.sun_path); + err = bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + } + + if (err < 0) { + err = -errno; + err(uctrl->udev, "bind failed: %m\n"); + return err; + } + + err = listen(uctrl->sock, 0); + if (err < 0) { + err = -errno; + err(uctrl->udev, "listen failed: %m\n"); + return err; + } + + uctrl->bound = true; + uctrl->cleanup_socket = true; + } + return 0; +} + +struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl) +{ + return uctrl->udev; +} + +struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return NULL; + uctrl->refcount++; + return uctrl; +} + +struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return NULL; + uctrl->refcount--; + if (uctrl->refcount > 0) + return uctrl; + if (uctrl->sock >= 0) + close(uctrl->sock); + free(uctrl); + return NULL; +} + +int udev_ctrl_cleanup(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return 0; + if (uctrl->cleanup_socket) + unlink(uctrl->saddr.sun_path); + return 0; +} + +int udev_ctrl_get_fd(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return -EINVAL; + return uctrl->sock; +} + +struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) +{ + struct udev_ctrl_connection *conn; + struct ucred ucred; + socklen_t slen; + const int on = 1; + + conn = calloc(1, sizeof(struct udev_ctrl_connection)); + if (conn == NULL) + return NULL; + conn->refcount = 1; + conn->uctrl = uctrl; + + conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK); + if (conn->sock < 0) { + if (errno != EINTR) + err(uctrl->udev, "unable to receive ctrl connection: %m\n"); + goto err; + } + + /* check peer credential of connection */ + slen = sizeof(ucred); + if (getsockopt(conn->sock, SOL_SOCKET, SO_PEERCRED, &ucred, &slen) < 0) { + err(uctrl->udev, "unable to receive credentials of ctrl connection: %m\n"); + goto err; + } + if (ucred.uid > 0) { + err(uctrl->udev, "sender uid=%i, message ignored\n", ucred.uid); + goto err; + } + + /* enable receiving of the sender credentials in the messages */ + setsockopt(conn->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + udev_ctrl_ref(uctrl); + return conn; +err: + if (conn->sock >= 0) + close(conn->sock); + free(conn); + return NULL; +} + +struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn) +{ + if (conn == NULL) + return NULL; + conn->refcount++; + return conn; +} + +struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn) +{ + if (conn == NULL) + return NULL; + conn->refcount--; + if (conn->refcount > 0) + return conn; + if (conn->sock >= 0) + close(conn->sock); + udev_ctrl_unref(conn->uctrl); + free(conn); + return NULL; +} + +static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf, int timeout) +{ + struct udev_ctrl_msg_wire ctrl_msg_wire; + int err = 0; + + memset(&ctrl_msg_wire, 0x00, sizeof(struct udev_ctrl_msg_wire)); + strcpy(ctrl_msg_wire.version, "udev-" VERSION); + ctrl_msg_wire.magic = UDEV_CTRL_MAGIC; + ctrl_msg_wire.type = type; + + if (buf != NULL) + util_strscpy(ctrl_msg_wire.buf, sizeof(ctrl_msg_wire.buf), buf); + else + ctrl_msg_wire.intval = intval; + + if (!uctrl->connected) { + if (connect(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen) < 0) { + err = -errno; + goto out; + } + uctrl->connected = true; + } + if (send(uctrl->sock, &ctrl_msg_wire, sizeof(ctrl_msg_wire), 0) < 0) { + err = -errno; + goto out; + } + + /* wait for peer message handling or disconnect */ + for (;;) { + struct pollfd pfd[1]; + int r; + + pfd[0].fd = uctrl->sock; + pfd[0].events = POLLIN; + r = poll(pfd, 1, timeout * 1000); + if (r < 0) { + if (errno == EINTR) + continue; + err = -errno; + break; + } + + if (r > 0 && pfd[0].revents & POLLERR) { + err = -EIO; + break; + } + + if (r == 0) + err = -ETIMEDOUT; + break; + } +out: + return err; +} + +int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_SET_LOG_LEVEL, priority, NULL, timeout); +} + +int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_STOP_EXEC_QUEUE, 0, NULL, timeout); +} + +int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL, timeout); +} + +int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_RELOAD_RULES, 0, NULL, timeout); +} + +int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key, timeout); +} + +int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_SET_CHILDREN_MAX, count, NULL, timeout); +} + +int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_PING, 0, NULL, timeout); +} + +int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_EXIT, 0, NULL, timeout); +} + +struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) +{ + struct udev *udev = conn->uctrl->udev; + struct udev_ctrl_msg *uctrl_msg; + ssize_t size; + struct msghdr smsg; + struct cmsghdr *cmsg; + struct iovec iov; + struct ucred *cred; + char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; + + uctrl_msg = calloc(1, sizeof(struct udev_ctrl_msg)); + if (uctrl_msg == NULL) + return NULL; + uctrl_msg->refcount = 1; + uctrl_msg->conn = conn; + udev_ctrl_connection_ref(conn); + + /* wait for the incoming message */ + for(;;) { + struct pollfd pfd[1]; + int r; + + pfd[0].fd = conn->sock; + pfd[0].events = POLLIN; + + r = poll(pfd, 1, 10000); + if (r < 0) { + if (errno == EINTR) + continue; + goto err; + } else if (r == 0) { + err(udev, "timeout waiting for ctrl message\n"); + goto err; + } else { + if (!(pfd[0].revents & POLLIN)) { + err(udev, "ctrl connection error: %m\n"); + goto err; + } + } + + break; + } + + iov.iov_base = &uctrl_msg->ctrl_msg_wire; + iov.iov_len = sizeof(struct udev_ctrl_msg_wire); + memset(&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = &iov; + smsg.msg_iovlen = 1; + smsg.msg_control = cred_msg; + smsg.msg_controllen = sizeof(cred_msg); + size = recvmsg(conn->sock, &smsg, 0); + if (size < 0) { + err(udev, "unable to receive ctrl message: %m\n"); + goto err; + } + cmsg = CMSG_FIRSTHDR(&smsg); + cred = (struct ucred *) CMSG_DATA(cmsg); + + if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { + err(udev, "no sender credentials received, message ignored\n"); + goto err; + } + + if (cred->uid != 0) { + err(udev, "sender uid=%i, message ignored\n", cred->uid); + goto err; + } + + if (uctrl_msg->ctrl_msg_wire.magic != UDEV_CTRL_MAGIC) { + err(udev, "message magic 0x%08x doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic); + goto err; + } + + dbg(udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); + return uctrl_msg; +err: + udev_ctrl_msg_unref(uctrl_msg); + return NULL; +} + +struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg == NULL) + return NULL; + ctrl_msg->refcount++; + return ctrl_msg; +} + +struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg == NULL) + return NULL; + ctrl_msg->refcount--; + if (ctrl_msg->refcount > 0) + return ctrl_msg; + dbg(ctrl_msg->conn->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg); + udev_ctrl_connection_unref(ctrl_msg->conn); + free(ctrl_msg); + return NULL; +} + +int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_LOG_LEVEL) + return ctrl_msg->ctrl_msg_wire.intval; + return -1; +} + +int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_STOP_EXEC_QUEUE) + return 1; + return -1; +} + +int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_START_EXEC_QUEUE) + return 1; + return -1; +} + +int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_RELOAD_RULES) + return 1; + return -1; +} + +const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_ENV) + return ctrl_msg->ctrl_msg_wire.buf; + return NULL; +} + +int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_CHILDREN_MAX) + return ctrl_msg->ctrl_msg_wire.intval; + return -1; +} + +int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_PING) + return 1; + return -1; +} + +int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_EXIT) + return 1; + return -1; +} diff --git a/udev/udev-event.c b/udev/udev-event.c index e87d703..7db7513 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -26,22 +26,30 @@ #include #include #include +#include +#include +#include +#include #include +#include #include #include "udev.h" struct udev_event *udev_event_new(struct udev_device *dev) { + struct udev *udev = udev_device_get_udev(dev); struct udev_event *event; event = calloc(1, sizeof(struct udev_event)); if (event == NULL) return NULL; - event->mode = 0600; event->dev = dev; - event->udev = udev_device_get_udev(dev); - udev_list_init(&event->run_list); + event->udev = udev; + udev_list_init(udev, &event->run_list, false); + event->fd_signal = -1; + event->birth_usec = now_usec(); + event->timeout_usec = 60 * 1000 * 1000; dbg(event->udev, "allocated event %p\n", event); return event; } @@ -50,11 +58,10 @@ void udev_event_unref(struct udev_event *event) { if (event == NULL) return; - udev_list_cleanup_entries(event->udev, &event->run_list); + udev_list_cleanup(&event->run_list); free(event->tmp_node); free(event->program_result); free(event->name); - free(event->smack); dbg(event->udev, "free event %p\n", event); free(event); } @@ -311,7 +318,7 @@ subst: len = strlen(vbuf); while (len > 0 && isspace(vbuf[--len])) vbuf[len] = '\0'; - count = udev_util_replace_chars(vbuf, UDEV_ALLOWED_CHARS_INPUT); + count = util_replace_chars(vbuf, UDEV_ALLOWED_CHARS_INPUT); if (count > 0) info(event->udev, "%i character(s) replaced\n" , count); l = util_strpcpy(&s, l, vbuf); @@ -381,7 +388,7 @@ subst: minor(udev_device_get_devnum(dev))); if (event->tmp_node == NULL) break; - udev_node_mknod(dev, event->tmp_node, 0600, 0, 0, NULL); + udev_node_mknod(dev, event->tmp_node, 0600, 0, 0); l = util_strpcpy(&s, l, event->tmp_node); break; } @@ -440,6 +447,383 @@ out: return l; } +static int spawn_exec(struct udev_event *event, + const char *cmd, char *const argv[], char **envp, const sigset_t *sigmask, + int fd_stdout, int fd_stderr) +{ + struct udev *udev = event->udev; + int err; + int fd; + + /* discard child output or connect to pipe */ + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + dup2(fd, STDIN_FILENO); + if (fd_stdout < 0) + dup2(fd, STDOUT_FILENO); + if (fd_stderr < 0) + dup2(fd, STDERR_FILENO); + close(fd); + } else { + err(udev, "open /dev/null failed: %m\n"); + } + + /* connect pipes to std{out,err} */ + if (fd_stdout >= 0) { + dup2(fd_stdout, STDOUT_FILENO); + close(fd_stdout); + } + if (fd_stderr >= 0) { + dup2(fd_stderr, STDERR_FILENO); + close(fd_stderr); + } + + /* terminate child in case parent goes away */ + prctl(PR_SET_PDEATHSIG, SIGTERM); + + /* restore original udev sigmask before exec */ + if (sigmask) + sigprocmask(SIG_SETMASK, sigmask, NULL); + + execve(argv[0], argv, envp); + + /* exec failed */ + err = -errno; + err(udev, "failed to execute '%s' '%s': %m\n", argv[0], cmd); + return err; +} + +static int spawn_read(struct udev_event *event, + const char *cmd, + int fd_stdout, int fd_stderr, + char *result, size_t ressize) +{ + struct udev *udev = event->udev; + size_t respos = 0; + int fd_ep = -1; + struct epoll_event ep_outpipe, ep_errpipe; + int err = 0; + + /* read from child if requested */ + if (fd_stdout < 0 && fd_stderr < 0) + return 0; + + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + err = -errno; + err(udev, "error creating epoll fd: %m\n"); + goto out; + } + + if (fd_stdout >= 0) { + memset(&ep_outpipe, 0, sizeof(struct epoll_event)); + ep_outpipe.events = EPOLLIN; + ep_outpipe.data.ptr = &fd_stdout; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stdout, &ep_outpipe) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + } + + if (fd_stderr >= 0) { + memset(&ep_errpipe, 0, sizeof(struct epoll_event)); + ep_errpipe.events = EPOLLIN; + ep_errpipe.data.ptr = &fd_stderr; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stderr, &ep_errpipe) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + } + + /* read child output */ + while (fd_stdout >= 0 || fd_stderr >= 0) { + int timeout; + int fdcount; + struct epoll_event ev[4]; + int i; + + if (event->timeout_usec > 0) { + unsigned long long age_usec; + + age_usec = now_usec() - event->birth_usec; + if (age_usec >= event->timeout_usec) { + err = -ETIMEDOUT; + err(udev, "timeout '%s'\n", cmd); + goto out; + } + timeout = ((event->timeout_usec - age_usec) / 1000) + 1000; + } else { + timeout = -1; + } + + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), timeout); + if (fdcount < 0) { + if (errno == EINTR) + continue; + err = -errno; + err(udev, "failed to poll: %m\n"); + goto out; + } + if (fdcount == 0) { + err = -ETIMEDOUT; + err(udev, "timeout '%s'\n", cmd); + goto out; + } + + for (i = 0; i < fdcount; i++) { + int *fd = (int *)ev[i].data.ptr; + + if (ev[i].events & EPOLLIN) { + ssize_t count; + char buf[4096]; + + count = read(*fd, buf, sizeof(buf)-1); + if (count <= 0) + continue; + buf[count] = '\0'; + + /* store stdout result */ + if (result != NULL && *fd == fd_stdout) { + if (respos + count < ressize) { + memcpy(&result[respos], buf, count); + respos += count; + } else { + err(udev, "'%s' ressize %zd too short\n", cmd, ressize); + err = -ENOBUFS; + } + } + + /* log debug output only if we watch stderr */ + if (fd_stderr >= 0) { + char *pos; + char *line; + + pos = buf; + while ((line = strsep(&pos, "\n"))) { + if (pos != NULL || line[0] != '\0') + info(udev, "'%s'(%s) '%s'\n", cmd, *fd == fd_stdout ? "out" : "err" , line); + } + } + } else if (ev[i].events & EPOLLHUP) { + if (epoll_ctl(fd_ep, EPOLL_CTL_DEL, *fd, NULL) < 0) { + err = -errno; + err(udev, "failed to remove fd from epoll: %m\n"); + goto out; + } + *fd = -1; + } + } + } + + /* return the child's stdout string */ + if (result != NULL) { + result[respos] = '\0'; + dbg(udev, "result='%s'\n", result); + } +out: + if (fd_ep >= 0) + close(fd_ep); + return err; +} + +static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid) +{ + struct udev *udev = event->udev; + struct pollfd pfd[1]; + int err = 0; + + pfd[0].events = POLLIN; + pfd[0].fd = event->fd_signal; + + while (pid > 0) { + int timeout; + int fdcount; + + if (event->timeout_usec > 0) { + unsigned long long age_usec; + + age_usec = now_usec() - event->birth_usec; + if (age_usec >= event->timeout_usec) + timeout = 1000; + else + timeout = ((event->timeout_usec - age_usec) / 1000) + 1000; + } else { + timeout = -1; + } + + fdcount = poll(pfd, 1, timeout); + if (fdcount < 0) { + if (errno == EINTR) + continue; + err = -errno; + err(udev, "failed to poll: %m\n"); + goto out; + } + if (fdcount == 0) { + err(udev, "timeout: killing '%s' [%u]\n", cmd, pid); + kill(pid, SIGKILL); + } + + if (pfd[0].revents & POLLIN) { + struct signalfd_siginfo fdsi; + int status; + ssize_t size; + + size = read(event->fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); + if (size != sizeof(struct signalfd_siginfo)) + continue; + + switch (fdsi.ssi_signo) { + case SIGTERM: + event->sigterm = true; + break; + case SIGCHLD: + if (waitpid(pid, &status, WNOHANG) < 0) + break; + if (WIFEXITED(status)) { + info(udev, "'%s' [%u] exit with return code %i\n", cmd, pid, WEXITSTATUS(status)); + if (WEXITSTATUS(status) != 0) + err = -1; + } else if (WIFSIGNALED(status)) { + err(udev, "'%s' [%u] terminated by signal %i (%s)\n", cmd, pid, WTERMSIG(status), strsignal(WTERMSIG(status))); + err = -1; + } else if (WIFSTOPPED(status)) { + err(udev, "'%s' [%u] stopped\n", cmd, pid); + err = -1; + } else if (WIFCONTINUED(status)) { + err(udev, "'%s' [%u] continued\n", cmd, pid); + err = -1; + } else { + err(udev, "'%s' [%u] exit with status 0x%04x\n", cmd, pid, status); + err = -1; + } + pid = 0; + break; + } + } + } +out: + return err; +} + +int udev_event_spawn(struct udev_event *event, + const char *cmd, char **envp, const sigset_t *sigmask, + char *result, size_t ressize) +{ + struct udev *udev = event->udev; + int outpipe[2] = {-1, -1}; + int errpipe[2] = {-1, -1}; + pid_t pid; + char arg[UTIL_PATH_SIZE]; + char program[UTIL_PATH_SIZE]; + char *argv[((sizeof(arg) + 1) / 2) + 1]; + int i; + int err = 0; + + /* build argv from command */ + util_strscpy(arg, sizeof(arg), cmd); + i = 0; + if (strchr(arg, ' ') != NULL) { + char *pos = arg; + + while (pos != NULL && pos[0] != '\0') { + if (pos[0] == '\'') { + /* do not separate quotes */ + pos++; + argv[i] = strsep(&pos, "\'"); + if (pos != NULL) + while (pos[0] == ' ') + pos++; + } else { + argv[i] = strsep(&pos, " "); + if (pos != NULL) + while (pos[0] == ' ') + pos++; + } + dbg(udev, "arg[%i] '%s'\n", i, argv[i]); + i++; + } + argv[i] = NULL; + } else { + argv[0] = arg; + argv[1] = NULL; + } + + /* pipes from child to parent */ + if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { + if (pipe2(outpipe, O_NONBLOCK) != 0) { + err = -errno; + err(udev, "pipe failed: %m\n"); + goto out; + } + } + if (udev_get_log_priority(udev) >= LOG_INFO) { + if (pipe2(errpipe, O_NONBLOCK) != 0) { + err = -errno; + err(udev, "pipe failed: %m\n"); + goto out; + } + } + + /* allow programs in /lib/udev/ to be called without the path */ + if (argv[0][0] != '/') { + util_strscpyl(program, sizeof(program), LIBEXECDIR "/", argv[0], NULL); + argv[0] = program; + } + + pid = fork(); + switch(pid) { + case 0: + /* child closes parent's ends of pipes */ + if (outpipe[READ_END] >= 0) { + close(outpipe[READ_END]); + outpipe[READ_END] = -1; + } + if (errpipe[READ_END] >= 0) { + close(errpipe[READ_END]); + errpipe[READ_END] = -1; + } + + info(udev, "starting '%s'\n", cmd); + + err = spawn_exec(event, cmd, argv, envp, sigmask, + outpipe[WRITE_END], errpipe[WRITE_END]); + + _exit(2 ); + case -1: + err(udev, "fork of '%s' failed: %m\n", cmd); + err = -1; + goto out; + default: + /* parent closed child's ends of pipes */ + if (outpipe[WRITE_END] >= 0) { + close(outpipe[WRITE_END]); + outpipe[WRITE_END] = -1; + } + if (errpipe[WRITE_END] >= 0) { + close(errpipe[WRITE_END]); + errpipe[WRITE_END] = -1; + } + + err = spawn_read(event, cmd, + outpipe[READ_END], errpipe[READ_END], + result, ressize); + + err = spawn_wait(event, cmd, pid); + } + +out: + if (outpipe[READ_END] >= 0) + close(outpipe[READ_END]); + if (outpipe[WRITE_END] >= 0) + close(outpipe[WRITE_END]); + if (errpipe[READ_END] >= 0) + close(errpipe[READ_END]); + if (errpipe[WRITE_END] >= 0) + close(errpipe[WRITE_END]); + return err; +} + static void rename_netif_kernel_log(struct ifreq ifr) { int klog; @@ -455,7 +839,7 @@ static void rename_netif_kernel_log(struct ifreq ifr) return; } - fprintf(f, "<6>udev[%u]: renamed network interface %s to %s\n", + fprintf(f, "<30>udevd[%u]: renamed network interface %s to %s\n", getpid(), ifr.ifr_name, ifr.ifr_newname); fclose(f); } @@ -493,7 +877,7 @@ static int rename_netif(struct udev_event *event) goto out; /* free our own name, another process may wait for us */ - util_strscpyl(ifr.ifr_newname, IFNAMSIZ, udev_device_get_sysname(dev), "-", event->name, NULL); + snprintf(ifr.ifr_newname, IFNAMSIZ, "rename%u", udev_device_get_ifindex(dev)); err = ioctl(sk, SIOCSIFNAME, &ifr); if (err < 0) { err = -errno; @@ -531,7 +915,7 @@ out: return err; } -int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) +int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigmask) { struct udev_device *dev = event->dev; int err = 0; @@ -540,21 +924,21 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) return -1; if (strcmp(udev_device_get_action(dev), "remove") == 0) { - udev_device_read_db(dev); + udev_device_read_db(dev, NULL); udev_device_delete_db(dev); udev_device_tag_index(dev, NULL, false); if (major(udev_device_get_devnum(dev)) != 0) udev_watch_end(event->udev, dev); - udev_rules_apply_to_event(rules, event); + udev_rules_apply_to_event(rules, event, sigmask); if (major(udev_device_get_devnum(dev)) != 0) err = udev_node_remove(dev); } else { event->dev_db = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev)); if (event->dev_db != NULL) { - udev_device_read_db(event->dev_db); + udev_device_read_db(event->dev_db, NULL); udev_device_set_info_loaded(event->dev_db); /* disable watch during event processing */ @@ -562,7 +946,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) udev_watch_end(event->udev, event->dev_db); } - udev_rules_apply_to_event(rules, event); + udev_rules_apply_to_event(rules, event, sigmask); /* rename a new network interface, if needed */ if (udev_device_get_ifindex(dev) > 0 && strcmp(udev_device_get_action(dev), "add") == 0 && @@ -574,10 +958,6 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) if (err == 0) { info(event->udev, "renamed netif to '%s'\n", event->name); - /* delete stale db file */ - udev_device_delete_db(dev); - udev_device_tag_index(dev, NULL, false); - /* remember old name */ udev_device_add_property(dev, "INTERFACE_OLD", udev_device_get_sysname(dev)); @@ -637,18 +1017,31 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) if (event->dev_db != NULL) udev_node_update_old_links(dev, event->dev_db); - /* change default 0600 to 0660 if a group is assigned */ - if (event->mode == 0600 && event->gid > 0) - event->mode = 0660; + if (!event->mode_set) { + if (udev_device_get_devnode_mode(dev) > 0) { + /* kernel supplied value */ + event->mode = udev_device_get_devnode_mode(dev); + } else if (event->gid > 0) { + /* default 0660 if a group is assigned */ + event->mode = 0660; + } else { + /* default 0600 */ + event->mode = 0600; + } + } + + /* set sticky bit, so we do not remove the node on module unload */ + if (event->static_node) + event->mode |= 01000; - err = udev_node_add(dev, event->mode, event->uid, event->gid, event->smack); + err = udev_node_add(dev, event->mode, event->uid, event->gid); } /* preserve old, or get new initialization timestamp */ if (event->dev_db != NULL && udev_device_get_usec_initialized(event->dev_db) > 0) udev_device_set_usec_initialized(event->dev, udev_device_get_usec_initialized(event->dev_db)); - else - udev_device_set_usec_initialized(event->dev, usec_monotonic()); + else if (udev_device_get_usec_initialized(event->dev) == 0) + udev_device_set_usec_initialized(event->dev, now_usec()); /* (re)write database file */ udev_device_update_db(dev); @@ -683,14 +1076,15 @@ int udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask) char program[UTIL_PATH_SIZE]; char **envp; - udev_event_apply_format(event, cmd, program, sizeof(program)); - envp = udev_device_get_properties_envp(event->dev); if (event->exec_delay > 0) { info(event->udev, "delay execution of '%s'\n", program); sleep(event->exec_delay); } - if (util_run_program(event->udev, program, envp, NULL, 0, NULL, sigmask, true) != 0) { - if (udev_list_entry_get_flags(list_entry)) + + udev_event_apply_format(event, cmd, program, sizeof(program)); + envp = udev_device_get_properties_envp(event->dev); + if (udev_event_spawn(event, program, envp, sigmask, NULL, 0) < 0) { + if (udev_list_entry_get_num(list_entry)) err = -1; } } diff --git a/udev/udev-node.c b/udev/udev-node.c index 201c9ca..f19dc4d 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -28,13 +28,12 @@ #include #include #include -#include #include "udev.h" #define TMP_FILE_EXT ".udev-tmp" -int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_t uid, gid_t gid, const char *smack) +int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_t uid, gid_t gid) { struct udev *udev = udev_device_get_udev(dev); dev_t devnum = udev_device_get_devnum(dev); @@ -53,7 +52,9 @@ int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_ if (lstat(file, &stats) == 0) { if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devnum)) { info(udev, "preserve file '%s', because it has correct dev_t\n", file); - if (stats.st_mode != mode || stats.st_uid != uid || stats.st_gid != gid) { + if ((stats.st_mode & 0777) != (mode & 0777) || stats.st_uid != uid || stats.st_gid != gid) { + /* preserve 'sticky' bit, if already set */ + mode |= stats.st_mode & 01000; info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); chmod(file, mode); chown(file, uid, gid); @@ -97,7 +98,7 @@ int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_ } else { info(udev, "mknod '%s' %u:%u %#o\n", file, major(devnum), minor(devnum), mode); do { - err = util_create_path(udev, file); + err = util_create_path_selinux(udev, file); if (err != 0 && err != -ENOENT) break; udev_selinux_setfscreatecon(udev, file, mode); @@ -106,19 +107,12 @@ int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_ err = -errno; udev_selinux_resetfscreatecon(udev); } while (err == -ENOENT); - if (err != 0) + if (err != 0 && err != -EEXIST) err(udev, "mknod '%s' %u:%u %#o' failed: %m\n", file, major(devnum), minor(devnum), mode); info(udev, "set permissions '%s' %#o uid=%u gid=%u\n", file, mode, uid, gid); chmod(file, mode); chown(file, uid, gid); } - - if (smack != NULL) { - err = lsetxattr(file, "security.SMACK64", smack, strlen(smack) + 1, 0); - if (err != 0) - err = -errno; - } - exit: return err; } @@ -192,7 +186,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) } else { info(udev, "creating symlink '%s' to '%s'\n", slink, target); do { - err = util_create_path(udev, slink); + err = util_create_path_selinux(udev, slink); if (err != 0 && err != -ENOENT) break; udev_selinux_setfscreatecon(udev, slink, S_IFLNK); @@ -209,7 +203,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) util_strscpyl(slink_tmp, sizeof(slink_tmp), slink, TMP_FILE_EXT, NULL); unlink(slink_tmp); do { - err = util_create_path(udev, slink_tmp); + err = util_create_path_selinux(udev, slink_tmp); if (err != 0 && err != -ENOENT) break; udev_selinux_setfscreatecon(udev, slink_tmp, S_IFLNK); @@ -300,7 +294,7 @@ static void link_update(struct udev_device *dev, const char *slink, bool add) dbg(udev, "update symlink '%s' of '%s'\n", slink, udev_device_get_syspath(dev)); util_path_encode(&slink[strlen(udev_get_dev_path(udev))+1], name_enc, sizeof(name_enc)); - util_strscpyl(dirname, sizeof(dirname), udev_get_dev_path(udev), "/.udev/links/", name_enc, NULL); + util_strscpyl(dirname, sizeof(dirname), udev_get_run_path(udev), "/links/", name_enc, NULL); util_strscpyl(filename, sizeof(filename), dirname, "/", udev_device_get_id_filename(dev), NULL); if (!add) { @@ -368,7 +362,7 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev } } -int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid, const char *smack) +int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) { struct udev *udev = udev_device_get_udev(dev); char filename[UTIL_PATH_SIZE]; @@ -380,7 +374,7 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid, co major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev)), mode, uid, gid); - if (udev_node_mknod(dev, NULL, mode, uid, gid, smack) != 0) { + if (udev_node_mknod(dev, NULL, mode, uid, gid) != 0) { err = -1; goto exit; } @@ -394,7 +388,7 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid, co /* create/update symlinks, add symlinks to name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { - if (udev_list_entry_get_flags(list_entry)) + if (udev_list_entry_get_num(list_entry)) /* simple unmanaged link name */ node_symlink(udev, udev_device_get_devnode(dev), udev_list_entry_get_name(list_entry)); else @@ -433,6 +427,11 @@ int udev_node_remove(struct udev_device *dev) goto out; } + if (stats.st_mode & 01000) { + info(udev, "device node '%s' has sticky bit set, skip removal\n", devnode); + goto out; + } + dev_check = udev_device_new_from_syspath(udev, udev_device_get_syspath(dev)); if (dev_check != NULL) { /* do not remove device node if the same sys-device is re-created in the meantime */ diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 9420d40..75636d9 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -36,8 +36,6 @@ #define PREALLOC_STRBUF 32 * 1024 #define PREALLOC_TRIE 256 -#define SMK_MAXLEN 23 - struct uid_gid { unsigned int name_off; union { @@ -138,12 +136,15 @@ enum token_type { TK_M_SUBSYSTEMS, /* val */ TK_M_DRIVERS, /* val */ TK_M_ATTRS, /* val, attr */ + TK_M_TAGS, /* val */ TK_M_PARENTS_MAX, TK_M_TEST, /* val, mode_t */ + TK_M_EVENT_TIMEOUT, /* int */ TK_M_PROGRAM, /* val */ TK_M_IMPORT_FILE, /* val */ TK_M_IMPORT_PROG, /* val */ + TK_M_IMPORT_BUILTIN, /* val */ TK_M_IMPORT_DB, /* val */ TK_M_IMPORT_CMDLINE, /* val */ TK_M_IMPORT_PARENT, /* val */ @@ -152,6 +153,7 @@ enum token_type { TK_A_STRING_ESCAPE_NONE, TK_A_STRING_ESCAPE_REPLACE, + TK_A_DB_PERSIST, TK_A_INOTIFY_WATCH, /* int */ TK_A_DEVLINK_PRIO, /* int */ TK_A_OWNER, /* val */ @@ -165,11 +167,9 @@ enum token_type { TK_A_TAG, /* val */ TK_A_NAME, /* val */ TK_A_DEVLINK, /* val */ - TK_A_EVENT_TIMEOUT, /* int */ TK_A_ATTR, /* val, attr */ TK_A_RUN, /* val, bool */ TK_A_GOTO, /* size_t */ - TK_A_SMACK, /* val */ TK_END, }; @@ -198,7 +198,6 @@ struct token { union { unsigned int attr_off; int devlink_unique; - int fail_on_error; unsigned int rule_goto; mode_t mode; uid_t uid; @@ -206,6 +205,7 @@ struct token { int devlink_prio; int event_timeout; int watch; + enum udev_builtin_cmd builtin_cmd; }; } key; }; @@ -273,12 +273,15 @@ static const char *token_str(enum token_type type) [TK_M_SUBSYSTEMS] = "M SUBSYSTEMS", [TK_M_DRIVERS] = "M DRIVERS", [TK_M_ATTRS] = "M ATTRS", + [TK_M_TAGS] = "M TAGS", [TK_M_PARENTS_MAX] = "M PARENTS_MAX", [TK_M_TEST] = "M TEST", + [TK_M_EVENT_TIMEOUT] = "M EVENT_TIMEOUT", [TK_M_PROGRAM] = "M PROGRAM", [TK_M_IMPORT_FILE] = "M IMPORT_FILE", [TK_M_IMPORT_PROG] = "M IMPORT_PROG", + [TK_M_IMPORT_BUILTIN] = "M IMPORT_BUILTIN", [TK_M_IMPORT_DB] = "M IMPORT_DB", [TK_M_IMPORT_CMDLINE] = "M IMPORT_CMDLINE", [TK_M_IMPORT_PARENT] = "M IMPORT_PARENT", @@ -287,6 +290,7 @@ static const char *token_str(enum token_type type) [TK_A_STRING_ESCAPE_NONE] = "A STRING_ESCAPE_NONE", [TK_A_STRING_ESCAPE_REPLACE] = "A STRING_ESCAPE_REPLACE", + [TK_A_DB_PERSIST] = "A DB_PERSIST", [TK_A_INOTIFY_WATCH] = "A INOTIFY_WATCH", [TK_A_DEVLINK_PRIO] = "A DEVLINK_PRIO", [TK_A_OWNER] = "A OWNER", @@ -300,7 +304,6 @@ static const char *token_str(enum token_type type) [TK_A_TAG] = "A ENV", [TK_A_NAME] = "A NAME", [TK_A_DEVLINK] = "A DEVLINK", - [TK_A_EVENT_TIMEOUT] = "A EVENT_TIMEOUT", [TK_A_ATTR] = "A ATTR", [TK_A_RUN] = "A RUN", [TK_A_GOTO] = "A GOTO", @@ -343,6 +346,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) case TK_M_KERNELS: case TK_M_SUBSYSTEMS: case TK_M_DRIVERS: + case TK_M_TAGS: case TK_M_PROGRAM: case TK_M_IMPORT_FILE: case TK_M_IMPORT_PROG: @@ -359,6 +363,9 @@ static void dump_token(struct udev_rules *rules, struct token *token) dbg(rules->udev, "%s %s '%s'(%s)\n", token_str(type), operation_str(op), value, string_glob_str(glob)); break; + case TK_M_IMPORT_BUILTIN: + dbg(rules->udev, "%s %i\n", token_str(type), token->key.builtin_cmd); + break; case TK_M_ATTR: case TK_M_ATTRS: case TK_M_ENV: @@ -373,6 +380,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) break; case TK_A_STRING_ESCAPE_NONE: case TK_A_STRING_ESCAPE_REPLACE: + case TK_A_DB_PERSIST: dbg(rules->udev, "%s\n", token_str(type)); break; case TK_M_TEST: @@ -397,7 +405,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) case TK_A_STATIC_NODE: dbg(rules->udev, "%s '%s'\n", token_str(type), value); break; - case TK_A_EVENT_TIMEOUT: + case TK_M_EVENT_TIMEOUT: dbg(rules->udev, "%s %u\n", token_str(type), token->key.event_timeout); break; case TK_A_GOTO: @@ -731,7 +739,7 @@ static int import_property_from_string(struct udev_device *dev, char *line) entry = udev_device_add_property(dev, key, val); /* store in db, skip private keys */ if (key[0] != '.') - udev_list_entry_set_flags(entry, 1); + udev_list_entry_set_num(entry, true); } return 0; } @@ -750,17 +758,18 @@ static int import_file_into_properties(struct udev_device *dev, const char *file return 0; } -static int import_program_into_properties(struct udev_device *dev, const char *program) +static int import_program_into_properties(struct udev_event *event, const char *program, const sigset_t *sigmask) { - struct udev *udev = udev_device_get_udev(dev); + struct udev_device *dev = event->dev; char **envp; char result[UTIL_LINE_SIZE]; - size_t reslen; char *line; + int err; envp = udev_device_get_properties_envp(dev); - if (util_run_program(udev, program, envp, result, sizeof(result), &reslen, NULL, false) != 0) - return -1; + err = udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)); + if (err < 0) + return err; line = result; while (line != NULL) { @@ -799,7 +808,7 @@ static int import_parent_into_properties(struct udev_device *dev, const char *fi entry = udev_device_add_property(dev, key, val); /* store in db, skip private keys */ if (key[0] != '.') - udev_list_entry_set_flags(entry, 1); + udev_list_entry_set_num(entry, true); } } return 0; @@ -1012,6 +1021,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, case TK_M_KERNELS: case TK_M_SUBSYSTEMS: case TK_M_DRIVERS: + case TK_M_TAGS: case TK_M_PROGRAM: case TK_M_IMPORT_FILE: case TK_M_IMPORT_PROG: @@ -1026,9 +1036,11 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, case TK_A_GOTO: case TK_M_TAG: case TK_A_TAG: - case TK_A_SMACK: token->key.value_off = add_string(rule_tmp->rules, value); break; + case TK_M_IMPORT_BUILTIN: + token->key.builtin_cmd = *(enum udev_builtin_cmd *)data; + break; case TK_M_ENV: case TK_M_ATTR: case TK_M_ATTRS: @@ -1049,10 +1061,10 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, break; case TK_A_STRING_ESCAPE_NONE: case TK_A_STRING_ESCAPE_REPLACE: + case TK_A_DB_PERSIST: break; case TK_A_RUN: token->key.value_off = add_string(rule_tmp->rules, value); - token->key.fail_on_error = *(int *)data; break; case TK_A_INOTIFY_WATCH: case TK_A_DEVLINK_PRIO: @@ -1070,7 +1082,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, case TK_A_STATIC_NODE: token->key.value_off = add_string(rule_tmp->rules, value); break; - case TK_A_EVENT_TIMEOUT: + case TK_M_EVENT_TIMEOUT: token->key.event_timeout = *(int *)data; break; case TK_RULE: @@ -1177,9 +1189,6 @@ static int add_rule(struct udev_rules *rules, char *line, char *linepos; char *attr; struct rule_tmp rule_tmp; - bool bus_warn = false; - bool sysfs_warn = false; - bool id_warn = false; memset(&rule_tmp, 0x00, sizeof(struct rule_tmp)); rule_tmp.rules = rules; @@ -1273,21 +1282,6 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcmp(key, "ID") == 0) { - if (!id_warn) { - id_warn = true; - err(rules->udev, "ID= will be removed in a future udev version, " - "please use KERNEL= to match the event device, or KERNELS= " - "to match a parent device, in %s:%u\n", filename, lineno); - } - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid KERNELS operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_KERNELS, op, value, NULL); - continue; - } - if (strcmp(key, "SUBSYSTEMS") == 0) { if (op > OP_MATCH_MAX) { err(rules->udev, "invalid SUBSYSTEMS operation\n"); @@ -1297,21 +1291,6 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcmp(key, "BUS") == 0) { - if (!bus_warn) { - bus_warn = true; - err(rules->udev, "BUS= will be removed in a future udev version, " - "please use SUBSYSTEM= to match the event device, or SUBSYSTEMS= " - "to match a parent device, in %s:%u\n", filename, lineno); - } - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid SUBSYSTEMS operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_SUBSYSTEMS, op, value, NULL); - continue; - } - if (strcmp(key, "DRIVERS") == 0) { if (op > OP_MATCH_MAX) { err(rules->udev, "invalid DRIVERS operation\n"); @@ -1341,23 +1320,12 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strncmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { - if (!sysfs_warn) { - sysfs_warn = true; - err(rules->udev, "SYSFS{}= will be removed in a future udev version, " - "please use ATTR{}= to match the event device, or ATTRS{}= " - "to match a parent device, in %s:%u\n", filename, lineno); - } + if (strcmp(key, "TAGS") == 0) { if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid ATTRS operation\n"); - goto invalid; - } - attr = get_key_attribute(rules->udev, key + sizeof("ATTRS")-1); - if (attr == NULL) { - err(rules->udev, "error parsing ATTRS attribute\n"); + err(rules->udev, "invalid TAGS operation\n"); goto invalid; } - rule_add_key(&rule_tmp, TK_M_ATTRS, op, value, attr); + rule_add_key(&rule_tmp, TK_M_TAGS, op, value, NULL); continue; } @@ -1371,6 +1339,26 @@ static int add_rule(struct udev_rules *rules, char *line, if (rule_add_key(&rule_tmp, TK_M_ENV, op, value, attr) != 0) goto invalid; } else { + static const char *blacklist[] = { + "ACTION", + "SUBSYSTEM", + "DEVTYPE", + "MAJOR", + "MINOR", + "DRIVER", + "IFINDEX", + "DEVNAME", + "DEVLINKS", + "DEVPATH", + "TAGS", + }; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(blacklist); i++) + if (strcmp(attr, blacklist[i]) == 0) { + err(rules->udev, "invalid ENV attribute, '%s' can not be set %s:%u\n", attr, filename, lineno); + continue; + } if (rule_add_key(&rule_tmp, TK_A_ENV, op, value, attr) != 0) goto invalid; } @@ -1401,43 +1389,50 @@ static int add_rule(struct udev_rules *rules, char *line, if (strncmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { attr = get_key_attribute(rules->udev, key + sizeof("IMPORT")-1); - if (attr != NULL && strstr(attr, "program")) { + if (attr == NULL) { + err(rules->udev, "IMPORT{} type missing, ignoring IMPORT %s:%u\n", filename, lineno); + continue; + } + if (strstr(attr, "program")) { + /* find known built-in command */ + if (value[0] != '/') { + char file[UTIL_PATH_SIZE]; + char *pos; + enum udev_builtin_cmd cmd; + + util_strscpy(file, sizeof(file), value); + pos = strchr(file, ' '); + if (pos) + pos[0] = '\0'; + cmd = udev_builtin_lookup(file); + if (cmd < UDEV_BUILTIN_MAX) { + info(rules->udev, "IMPORT found builtin '%s', replacing %s:%u\n", file, filename, lineno); + rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, NULL, &cmd); + continue; + } + } dbg(rules->udev, "IMPORT will be executed\n"); rule_add_key(&rule_tmp, TK_M_IMPORT_PROG, op, value, NULL); - } else if (attr != NULL && strstr(attr, "file")) { + } else if (strstr(attr, "builtin")) { + enum udev_builtin_cmd cmd = udev_builtin_lookup(value); + + dbg(rules->udev, "IMPORT execute builtin\n"); + if (cmd < UDEV_BUILTIN_MAX) + rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, NULL, &cmd); + else + err(rules->udev, "IMPORT{builtin}: '%s' unknown %s:%u\n", value, filename, lineno); + } else if (strstr(attr, "file")) { dbg(rules->udev, "IMPORT will be included as file\n"); rule_add_key(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL); - } else if (attr != NULL && strstr(attr, "db")) { + } else if (strstr(attr, "db")) { dbg(rules->udev, "IMPORT will include db values\n"); rule_add_key(&rule_tmp, TK_M_IMPORT_DB, op, value, NULL); - } else if (attr != NULL && strstr(attr, "cmdline")) { + } else if (strstr(attr, "cmdline")) { dbg(rules->udev, "IMPORT will include db values\n"); rule_add_key(&rule_tmp, TK_M_IMPORT_CMDLINE, op, value, NULL); - } else if (attr != NULL && strstr(attr, "parent")) { + } else if (strstr(attr, "parent")) { dbg(rules->udev, "IMPORT will include the parent values\n"); rule_add_key(&rule_tmp, TK_M_IMPORT_PARENT, op, value, NULL); - } else { - /* figure it out if it is executable */ - char file[UTIL_PATH_SIZE]; - char *pos; - struct stat statbuf; - - /* allow programs in /lib/udev called without the path */ - if (value[0] != '/') - util_strscpyl(file, sizeof(file), LIBEXECDIR "/", value, NULL); - else - util_strscpy(file, sizeof(file), value); - pos = strchr(file, ' '); - if (pos) - pos[0] = '\0'; - dbg(rules->udev, "IMPORT auto mode for '%s'\n", file); - if (stat(file, &statbuf) == 0 && (statbuf.st_mode & S_IXUSR)) { - dbg(rules->udev, "IMPORT will be executed (autotype)\n"); - rule_add_key(&rule_tmp, TK_M_IMPORT_PROG, op, value, NULL); - } else { - dbg(rules->udev, "IMPORT will be included as file (autotype)\n"); - rule_add_key(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL); - } } continue; } @@ -1459,13 +1454,8 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strncmp(key, "RUN", sizeof("RUN")-1) == 0) { - int flag = 0; - - attr = get_key_attribute(rules->udev, key + sizeof("RUN")-1); - if (attr != NULL && strstr(attr, "fail_event_on_error")) - flag = 1; - rule_add_key(&rule_tmp, TK_A_RUN, op, value, &flag); + if (strcmp(key, "RUN") == 0) { + rule_add_key(&rule_tmp, TK_A_RUN, op, value, NULL); continue; } @@ -1553,24 +1543,6 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strncmp(key, "SMACK", sizeof("SMACK")-1) == 0) { - if (value[0] == '\0') { - info(rules->udev, "SMACK=\"\" is ignored, invalid label \"\" " - "please remove it from %s:%u\n", filename, lineno); - continue; - } - - if (strnlen(value, SMK_MAXLEN + 1) > SMK_MAXLEN) { - info(rules->udev, "SMACK=\"%s\" is ignored, label \"%s\" exceeds %d characters " - "please remove it from %s:%u\n", value, value, SMK_MAXLEN, filename, lineno); - continue; - } - - rule_add_key(&rule_tmp, TK_A_SMACK, op, value, NULL); - rule_tmp.rule.rule.can_set_name = true; - continue; - } - if (strcmp(key, "MODE") == 0) { mode_t mode; char *endptr; @@ -1594,13 +1566,15 @@ static int add_rule(struct udev_rules *rules, char *line, rule_add_key(&rule_tmp, TK_A_DEVLINK_PRIO, op, NULL, &prio); dbg(rules->udev, "link priority=%i\n", prio); } + pos = strstr(value, "event_timeout="); if (pos != NULL) { int tout = atoi(&pos[strlen("event_timeout=")]); - rule_add_key(&rule_tmp, TK_A_EVENT_TIMEOUT, op, NULL, &tout); + rule_add_key(&rule_tmp, TK_M_EVENT_TIMEOUT, op, NULL, &tout); dbg(rules->udev, "event timeout=%i\n", tout); } + pos = strstr(value, "string_escape="); if (pos != NULL) { pos = &pos[strlen("string_escape=")]; @@ -1609,6 +1583,11 @@ static int add_rule(struct udev_rules *rules, char *line, else if (strncmp(pos, "replace", strlen("replace")) == 0) rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_REPLACE, op, NULL, NULL); } + + pos = strstr(value, "db_persist"); + if (pos != NULL) + rule_add_key(&rule_tmp, TK_A_DB_PERSIST, op, NULL, NULL); + pos = strstr(value, "nowatch"); if (pos != NULL) { const int off = 0; @@ -1624,11 +1603,13 @@ static int add_rule(struct udev_rules *rules, char *line, dbg(rules->udev, "inotify watch of device requested\n"); } } + pos = strstr(value, "static_node="); if (pos != NULL) { rule_add_key(&rule_tmp, TK_A_STATIC_NODE, op, &pos[strlen("static_node=")], NULL); rule_tmp.rule.rule.has_static_node = true; } + continue; } err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno); @@ -1724,9 +1705,10 @@ static int parse_file(struct udev_rules *rules, const char *filename, unsigned s return 0; } -static int add_matching_files(struct udev *udev, struct udev_list_node *file_list, const char *dirname, const char *suffix) +static int add_matching_files(struct udev *udev, struct udev_list *file_list, const char *dirname, const char *suffix) { DIR *dir; + struct dirent *dent; char filename[UTIL_PATH_SIZE]; dbg(udev, "open directory '%s'\n", dirname); @@ -1736,13 +1718,7 @@ static int add_matching_files(struct udev *udev, struct udev_list_node *file_lis return -1; } - for (;;) { - struct dirent *dent; - - dent = readdir(dir); - if (dent == NULL || dent->d_name[0] == '\0') - break; - + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { if (dent->d_name[0] == '.') continue; @@ -1758,7 +1734,12 @@ static int add_matching_files(struct udev *udev, struct udev_list_node *file_lis } util_strscpyl(filename, sizeof(filename), dirname, "/", dent->d_name, NULL); dbg(udev, "put file '%s' into list\n", filename); - udev_list_entry_add(udev, file_list, filename, NULL, 1, 1); + /* + * the basename is the key, the filename the value + * identical basenames from different directories overwrite each other + * entries are sorted after basename + */ + udev_list_entry_add(file_list, dent->d_name, filename); } closedir(dir); @@ -1768,9 +1749,8 @@ static int add_matching_files(struct udev *udev, struct udev_list_node *file_lis struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) { struct udev_rules *rules; - struct stat statbuf; - struct udev_list_node file_list; - struct udev_list_entry *file_loop, *file_tmp; + struct udev_list file_list; + struct udev_list_entry *file_loop; struct token end_token; rules = calloc(1, sizeof(struct udev_rules)); @@ -1778,7 +1758,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) return NULL; rules->udev = udev; rules->resolve_names = resolve_names; - udev_list_init(&file_list); + udev_list_init(udev, &file_list, true); /* init token array and string buffer */ rules->tokens = malloc(PREALLOC_TOKEN * sizeof(struct token)); @@ -1813,85 +1793,55 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) memset(rules->trie_nodes, 0x00, sizeof(struct trie_node)); rules->trie_nodes_cur = 1; - if (udev_get_rules_path(udev) != NULL) { - /* custom rules location for testing */ - add_matching_files(udev, &file_list, udev_get_rules_path(udev), ".rules"); - } else { - char filename[PATH_MAX]; - struct udev_list_node sort_list; - struct udev_list_entry *sort_loop, *sort_tmp; - - /* read user/custom rules */ - add_matching_files(udev, &file_list, SYSCONFDIR "/udev/rules.d", ".rules"); - - /* read dynamic/temporary rules */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/rules.d", NULL); - udev_list_init(&sort_list); - add_matching_files(udev, &sort_list, filename, ".rules"); - - /* read default rules */ - add_matching_files(udev, &sort_list, LIBEXECDIR "/rules.d", ".rules"); + if (udev_get_rules_path(udev) == NULL) { + char filename[UTIL_PATH_SIZE]; - /* sort all rules files by basename into list of files */ - udev_list_entry_foreach_safe(sort_loop, sort_tmp, udev_list_get_entry(&sort_list)) { - const char *sort_name = udev_list_entry_get_name(sort_loop); - const char *sort_base = strrchr(sort_name, '/'); + /* /lib/udev -- default/package rules */ + add_matching_files(udev, &file_list, LIBEXECDIR "/rules.d", ".rules"); - if (sort_base == NULL) - continue; - /* sort entry into existing list */ - udev_list_entry_foreach_safe(file_loop, file_tmp, udev_list_get_entry(&file_list)) { - const char *file_name = udev_list_entry_get_name(file_loop); - const char *file_base = strrchr(file_name, '/'); + /* /etc/udev -- system-specific/user/admin rules */ + add_matching_files(udev, &file_list, SYSCONFDIR "/udev/rules.d", ".rules"); - if (file_base == NULL) - continue; - if (strcmp(file_base, sort_base) == 0) { - info(udev, "rule file basename '%s' already added, ignoring '%s'\n", - file_name, sort_name); - udev_list_entry_delete(sort_loop); - sort_loop = NULL; - break; - } - if (strcmp(file_base, sort_base) > 0) { - /* found later file, insert before */ - udev_list_entry_remove(sort_loop); - udev_list_entry_insert_before(sort_loop, file_loop); - sort_loop = NULL; - break; - } - } - /* current file already handled */ - if (sort_loop == NULL) - continue; - /* no later file, append to end of list */ - udev_list_entry_remove(sort_loop); - udev_list_entry_append(sort_loop, &file_list); - } + /* /run/udev -- throw-away/temporary rules */ + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/rules.d", NULL); + add_matching_files(udev, &file_list, filename, ".rules"); + } else { + /* custom rules files location for testing */ + add_matching_files(udev, &file_list, udev_get_rules_path(udev), ".rules"); } /* add all filenames to the string buffer */ udev_list_entry_foreach(file_loop, udev_list_get_entry(&file_list)) { - const char *filename = udev_list_entry_get_name(file_loop); + const char *filename = udev_list_entry_get_value(file_loop); unsigned int filename_off; filename_off = add_string(rules, filename); /* the offset in the rule is limited to unsigned short */ if (filename_off < USHRT_MAX) - udev_list_entry_set_flags(file_loop, filename_off); + udev_list_entry_set_num(file_loop, filename_off); } - /* parse list of files */ - udev_list_entry_foreach_safe(file_loop, file_tmp, udev_list_get_entry(&file_list)) { - const char *filename = udev_list_entry_get_name(file_loop); - unsigned int filename_off = udev_list_entry_get_flags(file_loop); + /* parse all rules files */ + udev_list_entry_foreach(file_loop, udev_list_get_entry(&file_list)) { + const char *filename = udev_list_entry_get_value(file_loop); + unsigned int filename_off = udev_list_entry_get_num(file_loop); + struct stat st; - if (stat(filename, &statbuf) == 0 && statbuf.st_size > 0) - parse_file(rules, filename, filename_off); - else - err(udev, "can not read '%s'\n", filename); - udev_list_entry_delete(file_loop); + if (stat(filename, &st) != 0) { + err(udev, "can not find '%s': %m\n", filename); + continue; + } + if (S_ISREG(st.st_mode) && st.st_size <= 0) { + info(udev, "ignore empty '%s'\n", filename); + continue; + } + if (S_ISCHR(st.st_mode)) { + info(udev, "ignore masked '%s'\n", filename); + continue; + } + parse_file(rules, filename, filename_off); } + udev_list_cleanup(&file_list); memset(&end_token, 0x00, sizeof(struct token)); end_token.type = TK_END; @@ -2090,7 +2040,7 @@ enum escape_type { ESCAPE_REPLACE, }; -int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event) +int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, const sigset_t *sigmask) { struct token *cur; struct token *rule; @@ -2130,58 +2080,55 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (match_key(rules, cur, udev_device_get_sysname(event->dev)) != 0) goto nomatch; break; - case TK_M_DEVLINK: - { - size_t devlen = strlen(udev_get_dev_path(event->udev))+1; - struct udev_list_entry *list_entry; - bool match = false; - - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(event->dev)) { - const char *devlink; - - devlink = &udev_list_entry_get_name(list_entry)[devlen]; - if (match_key(rules, cur, devlink) == 0) { - match = true; - break; - } + case TK_M_DEVLINK: { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + struct udev_list_entry *list_entry; + bool match = false; + + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(event->dev)) { + const char *devlink; + + devlink = &udev_list_entry_get_name(list_entry)[devlen]; + if (match_key(rules, cur, devlink) == 0) { + match = true; + break; } - if (!match) - goto nomatch; - break; } + if (!match) + goto nomatch; + break; + } case TK_M_NAME: if (match_key(rules, cur, event->name) != 0) goto nomatch; break; - case TK_M_ENV: - { - const char *key_name = &rules->buf[cur->key.attr_off]; - const char *value; - - value = udev_device_get_property_value(event->dev, key_name); - if (value == NULL) { - dbg(event->udev, "ENV{%s} is not set, treat as empty\n", key_name); - value = ""; - } - if (match_key(rules, cur, value)) - goto nomatch; - break; + case TK_M_ENV: { + const char *key_name = &rules->buf[cur->key.attr_off]; + const char *value; + + value = udev_device_get_property_value(event->dev, key_name); + if (value == NULL) { + dbg(event->udev, "ENV{%s} is not set, treat as empty\n", key_name); + value = ""; } - case TK_M_TAG: - { - struct udev_list_entry *list_entry; - bool match = false; - - udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(event->dev)) { - if (strcmp(&rules->buf[cur->key.value_off], udev_list_entry_get_name(list_entry)) == 0) { - match = true; - break; - } + if (match_key(rules, cur, value)) + goto nomatch; + break; + } + case TK_M_TAG: { + struct udev_list_entry *list_entry; + bool match = false; + + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(event->dev)) { + if (strcmp(&rules->buf[cur->key.value_off], udev_list_entry_get_name(list_entry)) == 0) { + match = true; + break; } - if (!match && (cur->key.op != OP_NOMATCH)) - goto nomatch; - break; } + if (!match && (cur->key.op != OP_NOMATCH)) + goto nomatch; + break; + } case TK_M_SUBSYSTEM: if (match_key(rules, cur, udev_device_get_subsystem(event->dev)) != 0) goto nomatch; @@ -2190,17 +2137,16 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (match_key(rules, cur, udev_device_get_driver(event->dev)) != 0) goto nomatch; break; - case TK_M_WAITFOR: - { - char filename[UTIL_PATH_SIZE]; - int found; - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); - found = (wait_for_file(event->dev, filename, 10) == 0); - if (!found && (cur->key.op != OP_NOMATCH)) - goto nomatch; - break; - } + case TK_M_WAITFOR: { + char filename[UTIL_PATH_SIZE]; + int found; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); + found = (wait_for_file(event->dev, filename, 10) == 0); + if (!found && (cur->key.op != OP_NOMATCH)) + goto nomatch; + break; + } case TK_M_ATTR: if (match_attr(rules, event->dev, event, cur) != 0) goto nomatch; @@ -2209,216 +2155,252 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event case TK_M_SUBSYSTEMS: case TK_M_DRIVERS: case TK_M_ATTRS: - { - struct token *next; + case TK_M_TAGS: { + struct token *next; - /* get whole sequence of parent matches */ - next = cur; - while (next->type > TK_M_PARENTS_MIN && next->type < TK_M_PARENTS_MAX) - next++; + /* get whole sequence of parent matches */ + next = cur; + while (next->type > TK_M_PARENTS_MIN && next->type < TK_M_PARENTS_MAX) + next++; - /* loop over parents */ - event->dev_parent = event->dev; - for (;;) { - struct token *key; - - dbg(event->udev, "parent: '%s'\n", udev_device_get_syspath(event->dev_parent)); - /* loop over sequence of parent match keys */ - for (key = cur; key < next; key++ ) { - dump_token(rules, key); - switch(key->type) { - case TK_M_KERNELS: - if (match_key(rules, key, udev_device_get_sysname(event->dev_parent)) != 0) - goto try_parent; - break; - case TK_M_SUBSYSTEMS: - if (match_key(rules, key, udev_device_get_subsystem(event->dev_parent)) != 0) - goto try_parent; - break; - case TK_M_DRIVERS: - if (match_key(rules, key, udev_device_get_driver(event->dev_parent)) != 0) - goto try_parent; - break; - case TK_M_ATTRS: - if (match_attr(rules, event->dev_parent, event, key) != 0) - goto try_parent; - break; - default: - goto nomatch; - } - dbg(event->udev, "parent key matched\n"); - } - dbg(event->udev, "all parent keys matched\n"); - /* all keys matched */ - break; + /* loop over parents */ + event->dev_parent = event->dev; + for (;;) { + struct token *key; + + dbg(event->udev, "parent: '%s'\n", udev_device_get_syspath(event->dev_parent)); + /* loop over sequence of parent match keys */ + for (key = cur; key < next; key++ ) { + dump_token(rules, key); + switch(key->type) { + case TK_M_KERNELS: + if (match_key(rules, key, udev_device_get_sysname(event->dev_parent)) != 0) + goto try_parent; + break; + case TK_M_SUBSYSTEMS: + if (match_key(rules, key, udev_device_get_subsystem(event->dev_parent)) != 0) + goto try_parent; + break; + case TK_M_DRIVERS: + if (match_key(rules, key, udev_device_get_driver(event->dev_parent)) != 0) + goto try_parent; + break; + case TK_M_ATTRS: + if (match_attr(rules, event->dev_parent, event, key) != 0) + goto try_parent; + break; + case TK_M_TAGS: { + bool match = udev_device_has_tag(event->dev_parent, &rules->buf[cur->key.value_off]); - try_parent: - event->dev_parent = udev_device_get_parent(event->dev_parent); - if (event->dev_parent == NULL) + if (match && key->key.op == OP_NOMATCH) + goto try_parent; + if (!match && key->key.op == OP_MATCH) + goto try_parent; + break; + } + default: goto nomatch; - } - /* move behind our sequence of parent match keys */ - cur = next; - continue; - } - case TK_M_TEST: - { - char filename[UTIL_PATH_SIZE]; - struct stat statbuf; - int match; - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); - if (util_resolve_subsys_kernel(event->udev, filename, filename, sizeof(filename), 0) != 0) { - if (filename[0] != '/') { - char tmp[UTIL_PATH_SIZE]; - - util_strscpy(tmp, sizeof(tmp), filename); - util_strscpyl(filename, sizeof(filename), - udev_device_get_syspath(event->dev), "/", tmp, NULL); } + dbg(event->udev, "parent key matched\n"); } - attr_subst_subdir(filename, sizeof(filename)); - - match = (stat(filename, &statbuf) == 0); - dbg(event->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n"); - if (match && cur->key.mode > 0) { - match = ((statbuf.st_mode & cur->key.mode) > 0); - dbg(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, - match ? "matches" : "does not match", cur->key.mode); - } - if (match && cur->key.op == OP_NOMATCH) - goto nomatch; - if (!match && cur->key.op == OP_MATCH) - goto nomatch; + dbg(event->udev, "all parent keys matched\n"); break; + + try_parent: + event->dev_parent = udev_device_get_parent(event->dev_parent); + if (event->dev_parent == NULL) + goto nomatch; } - case TK_M_PROGRAM: - { - char program[UTIL_PATH_SIZE]; - char **envp; - char result[UTIL_PATH_SIZE]; - - free(event->program_result); - event->program_result = NULL; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], program, sizeof(program)); - envp = udev_device_get_properties_envp(event->dev); - info(event->udev, "PROGRAM '%s' %s:%u\n", - program, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - if (util_run_program(event->udev, program, envp, result, sizeof(result), NULL, NULL, false) != 0) { - if (cur->key.op != OP_NOMATCH) - goto nomatch; - } else { - int count; + /* move behind our sequence of parent match keys */ + cur = next; + continue; + } + case TK_M_TEST: { + char filename[UTIL_PATH_SIZE]; + struct stat statbuf; + int match; - util_remove_trailing_chars(result, '\n'); - if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { - count = udev_util_replace_chars(result, UDEV_ALLOWED_CHARS_INPUT); - if (count > 0) - info(event->udev, "%i character(s) replaced\n" , count); - } - event->program_result = strdup(result); - dbg(event->udev, "storing result '%s'\n", event->program_result); - if (cur->key.op == OP_NOMATCH) - goto nomatch; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); + if (util_resolve_subsys_kernel(event->udev, filename, filename, sizeof(filename), 0) != 0) { + if (filename[0] != '/') { + char tmp[UTIL_PATH_SIZE]; + + util_strscpy(tmp, sizeof(tmp), filename); + util_strscpyl(filename, sizeof(filename), + udev_device_get_syspath(event->dev), "/", tmp, NULL); } - break; } - case TK_M_IMPORT_FILE: - { - char import[UTIL_PATH_SIZE]; + attr_subst_subdir(filename, sizeof(filename)); - udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); - if (import_file_into_properties(event->dev, import) != 0) - if (cur->key.op != OP_NOMATCH) - goto nomatch; - break; + match = (stat(filename, &statbuf) == 0); + dbg(event->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n"); + if (match && cur->key.mode > 0) { + match = ((statbuf.st_mode & cur->key.mode) > 0); + dbg(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, + match ? "matches" : "does not match", cur->key.mode); } - case TK_M_IMPORT_PROG: - { - char import[UTIL_PATH_SIZE]; + if (match && cur->key.op == OP_NOMATCH) + goto nomatch; + if (!match && cur->key.op == OP_MATCH) + goto nomatch; + break; + } + case TK_M_EVENT_TIMEOUT: + info(event->udev, "OPTIONS event_timeout=%u\n", cur->key.event_timeout); + event->timeout_usec = cur->key.event_timeout * 1000 * 1000; + break; + case TK_M_PROGRAM: { + char program[UTIL_PATH_SIZE]; + char **envp; + char result[UTIL_PATH_SIZE]; + + free(event->program_result); + event->program_result = NULL; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], program, sizeof(program)); + envp = udev_device_get_properties_envp(event->dev); + info(event->udev, "PROGRAM '%s' %s:%u\n", + program, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + + if (udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)) < 0) { + if (cur->key.op != OP_NOMATCH) + goto nomatch; + } else { + int count; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); - info(event->udev, "IMPORT '%s' %s:%u\n", - import, + util_remove_trailing_chars(result, '\n'); + if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { + count = util_replace_chars(result, UDEV_ALLOWED_CHARS_INPUT); + if (count > 0) + info(event->udev, "%i character(s) replaced\n" , count); + } + event->program_result = strdup(result); + dbg(event->udev, "storing result '%s'\n", event->program_result); + if (cur->key.op == OP_NOMATCH) + goto nomatch; + } + break; + } + case TK_M_IMPORT_FILE: { + char import[UTIL_PATH_SIZE]; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); + if (import_file_into_properties(event->dev, import) != 0) + if (cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } + case TK_M_IMPORT_PROG: { + char import[UTIL_PATH_SIZE]; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); + info(event->udev, "IMPORT '%s' %s:%u\n", + import, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + + if (import_program_into_properties(event, import, sigmask) != 0) + if (cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } + case TK_M_IMPORT_BUILTIN: { + /* check if we ran already */ + if (event->builtin_run & (1 << cur->key.builtin_cmd)) { + info(event->udev, "IMPORT builtin skip '%s' %s:%u\n", + udev_builtin_name(cur->key.builtin_cmd), &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - if (import_program_into_properties(event->dev, import) != 0) + /* return the result from earlier run */ + if (event->builtin_ret & (1 << cur->key.builtin_cmd)) if (cur->key.op != OP_NOMATCH) goto nomatch; break; } - case TK_M_IMPORT_DB: - { - const char *key = &rules->buf[cur->key.value_off]; - const char *value; + /* mark as ran */ + event->builtin_run |= (1 << cur->key.builtin_cmd); + info(event->udev, "IMPORT builtin '%s' %s:%u\n", + udev_builtin_name(cur->key.builtin_cmd), + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + if (udev_builtin_run(event->dev, cur->key.builtin_cmd, false) != 0) { + /* remember failure */ + info(rules->udev, "IMPORT builtin '%s' returned non-zero\n", + udev_builtin_name(cur->key.builtin_cmd)); + event->builtin_ret |= (1 << cur->key.builtin_cmd); + if (cur->key.op != OP_NOMATCH) + goto nomatch; + } + break; + } + case TK_M_IMPORT_DB: { + const char *key = &rules->buf[cur->key.value_off]; + const char *value; - value = udev_device_get_property_value(event->dev_db, key); - if (value != NULL) { - struct udev_list_entry *entry; + value = udev_device_get_property_value(event->dev_db, key); + if (value != NULL) { + struct udev_list_entry *entry; - entry = udev_device_add_property(event->dev, key, value); - udev_list_entry_set_flags(entry, 1); - } else { - if (cur->key.op != OP_NOMATCH) - goto nomatch; - } - break; + entry = udev_device_add_property(event->dev, key, value); + udev_list_entry_set_num(entry, true); + } else { + if (cur->key.op != OP_NOMATCH) + goto nomatch; } - case TK_M_IMPORT_CMDLINE: - { - FILE *f; - bool imported = false; - - f = fopen("/proc/cmdline", "r"); - if (f != NULL) { - char cmdline[4096]; - - if (fgets(cmdline, sizeof(cmdline), f) != NULL) { - const char *key = &rules->buf[cur->key.value_off]; - char *pos; - - pos = strstr(cmdline, key); - if (pos != NULL) { - struct udev_list_entry *entry; - - pos += strlen(key); - if (pos[0] == '\0' || isspace(pos[0])) { - /* we import simple flags as 'FLAG=1' */ - entry = udev_device_add_property(event->dev, key, "1"); - udev_list_entry_set_flags(entry, 1); - imported = true; - } else if (pos[0] == '=') { - const char *value; - + break; + } + case TK_M_IMPORT_CMDLINE: { + FILE *f; + bool imported = false; + + f = fopen("/proc/cmdline", "r"); + if (f != NULL) { + char cmdline[4096]; + + if (fgets(cmdline, sizeof(cmdline), f) != NULL) { + const char *key = &rules->buf[cur->key.value_off]; + char *pos; + + pos = strstr(cmdline, key); + if (pos != NULL) { + struct udev_list_entry *entry; + + pos += strlen(key); + if (pos[0] == '\0' || isspace(pos[0])) { + /* we import simple flags as 'FLAG=1' */ + entry = udev_device_add_property(event->dev, key, "1"); + udev_list_entry_set_num(entry, true); + imported = true; + } else if (pos[0] == '=') { + const char *value; + + pos++; + value = pos; + while (pos[0] != '\0' && !isspace(pos[0])) pos++; - value = pos; - while (pos[0] != '\0' && !isspace(pos[0])) - pos++; - pos[0] = '\0'; - entry = udev_device_add_property(event->dev, key, value); - udev_list_entry_set_flags(entry, 1); - imported = true; - } + pos[0] = '\0'; + entry = udev_device_add_property(event->dev, key, value); + udev_list_entry_set_num(entry, true); + imported = true; } } - fclose(f); } - if (!imported && cur->key.op != OP_NOMATCH) - goto nomatch; - break; + fclose(f); } - case TK_M_IMPORT_PARENT: - { - char import[UTIL_PATH_SIZE]; + if (!imported && cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } + case TK_M_IMPORT_PARENT: { + char import[UTIL_PATH_SIZE]; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); - if (import_parent_into_properties(event->dev, import) != 0) - if (cur->key.op != OP_NOMATCH) - goto nomatch; - break; - } + udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); + if (import_parent_into_properties(event->dev, import) != 0) + if (cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } case TK_M_RESULT: if (match_key(rules, cur, event->program_result) != 0) goto nomatch; @@ -2429,6 +2411,9 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event case TK_A_STRING_ESCAPE_REPLACE: esc = ESCAPE_REPLACE; break; + case TK_A_DB_PERSIST: + udev_device_set_db_persist(event->dev); + break; case TK_A_INOTIFY_WATCH: if (event->inotify_watch_final) break; @@ -2439,79 +2424,59 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event case TK_A_DEVLINK_PRIO: udev_device_set_devlink_priority(event->dev, cur->key.devlink_prio); break; - case TK_A_OWNER: - { - char owner[UTIL_NAME_SIZE]; - - if (event->owner_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->owner_final = true; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], owner, sizeof(owner)); - event->uid = util_lookup_user(event->udev, owner); - info(event->udev, "OWNER %u %s:%u\n", - event->uid, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - break; - } - case TK_A_GROUP: - { - char group[UTIL_NAME_SIZE]; + case TK_A_OWNER: { + char owner[UTIL_NAME_SIZE]; - if (event->group_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->group_final = true; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], group, sizeof(group)); - event->gid = util_lookup_group(event->udev, group); - info(event->udev, "GROUP %u %s:%u\n", - event->gid, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); + if (event->owner_final) break; - } - case TK_A_SMACK: - { - const char *smack = &rules->buf[cur->key.value_off]; - char smack_str[UTIL_PATH_SIZE]; + if (cur->key.op == OP_ASSIGN_FINAL) + event->owner_final = true; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], owner, sizeof(owner)); + event->uid = util_lookup_user(event->udev, owner); + info(event->udev, "OWNER %u %s:%u\n", + event->uid, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + } + case TK_A_GROUP: { + char group[UTIL_NAME_SIZE]; - if (event->smack_final) + if (event->group_final) break; if (cur->key.op == OP_ASSIGN_FINAL) - event->smack_final = true; - - udev_event_apply_format(event, smack, smack_str, sizeof(smack_str)); - free(event->smack); - event->smack = strdup(smack_str); - - info(event->udev, "SMACK '%s' %s:%u\n", - event->smack, + event->group_final = true; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], group, sizeof(group)); + event->gid = util_lookup_group(event->udev, group); + info(event->udev, "GROUP %u %s:%u\n", + event->gid, &rules->buf[rule->rule.filename_off], rule->rule.filename_line); break; } - case TK_A_MODE: - { - char mode[UTIL_NAME_SIZE]; - char *endptr; + case TK_A_MODE: { + char mode_str[UTIL_NAME_SIZE]; + mode_t mode; + char *endptr; - if (event->mode_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->mode_final = true; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], mode, sizeof(mode)); - event->mode = strtol(mode, &endptr, 8); - if (endptr[0] != '\0') { - err(event->udev, "invalide mode '%s' set default mode 0600\n", mode); - event->mode = 0600; - } - info(event->udev, "MODE %#o %s:%u\n", - event->mode, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); + if (event->mode_final) + break; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], mode_str, sizeof(mode_str)); + mode = strtol(mode_str, &endptr, 8); + if (endptr[0] != '\0') { + err(event->udev, "ignoring invalid mode '%s'\n", mode_str); break; } + if (cur->key.op == OP_ASSIGN_FINAL) + event->mode_final = true; + event->mode_set = true; + event->mode = mode; + info(event->udev, "MODE %#o %s:%u\n", + event->mode, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + } case TK_A_OWNER_ID: if (event->owner_final) break; @@ -2539,6 +2504,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; if (cur->key.op == OP_ASSIGN_FINAL) event->mode_final = true; + event->mode_set = true; event->mode = cur->key.mode; info(event->udev, "MODE %#o %s:%u\n", event->mode, @@ -2546,147 +2512,149 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event rule->rule.filename_line); break; case TK_A_STATIC_NODE: + event->static_node = true; break; - case TK_A_ENV: - { - const char *name = &rules->buf[cur->key.attr_off]; - char *value = &rules->buf[cur->key.value_off]; - - if (value[0] != '\0') { - char temp_value[UTIL_NAME_SIZE]; - struct udev_list_entry *entry; - - udev_event_apply_format(event, value, temp_value, sizeof(temp_value)); - entry = udev_device_add_property(event->dev, name, temp_value); - /* store in db, skip private keys */ - if (name[0] != '.') - udev_list_entry_set_flags(entry, 1); - } else { - udev_device_add_property(event->dev, name, NULL); - } - break; + case TK_A_ENV: { + const char *name = &rules->buf[cur->key.attr_off]; + char *value = &rules->buf[cur->key.value_off]; + + if (value[0] != '\0') { + char temp_value[UTIL_NAME_SIZE]; + struct udev_list_entry *entry; + + udev_event_apply_format(event, value, temp_value, sizeof(temp_value)); + entry = udev_device_add_property(event->dev, name, temp_value); + /* store in db, skip private keys */ + if (name[0] != '.') + udev_list_entry_set_num(entry, true); + } else { + udev_device_add_property(event->dev, name, NULL); } - case TK_A_TAG: + break; + } + case TK_A_TAG: { + char tag[UTIL_PATH_SIZE]; + const char *p; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], tag, sizeof(tag)); if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) udev_device_cleanup_tags_list(event->dev); - udev_device_add_tag(event->dev, &rules->buf[cur->key.value_off]); + for (p = tag; *p != '\0'; p++) { + if ((*p >= 'a' && *p <= 'z') || + (*p >= 'A' && *p <= 'Z') || + (*p >= '0' && *p <= '9') || + *p == '-' || *p == '_') + continue; + err(event->udev, "ignoring invalid tag name '%s'\n", tag); + break; + } + udev_device_add_tag(event->dev, tag); break; - case TK_A_NAME: - { - const char *name = &rules->buf[cur->key.value_off]; - char name_str[UTIL_PATH_SIZE]; - int count; + } + case TK_A_NAME: { + const char *name = &rules->buf[cur->key.value_off]; + char name_str[UTIL_PATH_SIZE]; + int count; - if (event->name_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->name_final = true; - udev_event_apply_format(event, name, name_str, sizeof(name_str)); - if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { - count = udev_util_replace_chars(name_str, "/"); - if (count > 0) - info(event->udev, "%i character(s) replaced\n", count); - } - free(event->name); - event->name = strdup(name_str); - info(event->udev, "NAME '%s' %s:%u\n", - event->name, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); + if (event->name_final) break; - } - case TK_A_DEVLINK: - { - char temp[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE]; - char *pos, *next; - int count = 0; - - if (event->devlink_final) - break; - if (major(udev_device_get_devnum(event->dev)) == 0) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->devlink_final = true; - if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) - udev_device_cleanup_devlinks_list(event->dev); - - /* allow multiple symlinks separated by spaces */ - udev_event_apply_format(event, &rules->buf[cur->key.value_off], temp, sizeof(temp)); - if (esc == ESCAPE_UNSET) - count = udev_util_replace_chars(temp, "/ "); - else if (esc == ESCAPE_REPLACE) - count = udev_util_replace_chars(temp, "/"); + if (cur->key.op == OP_ASSIGN_FINAL) + event->name_final = true; + udev_event_apply_format(event, name, name_str, sizeof(name_str)); + if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { + count = util_replace_chars(name_str, "/"); if (count > 0) - info(event->udev, "%i character(s) replaced\n" , count); - dbg(event->udev, "rule applied, added symlink(s) '%s'\n", temp); - pos = temp; - while (isspace(pos[0])) - pos++; - next = strchr(pos, ' '); - while (next != NULL) { - next[0] = '\0'; - info(event->udev, "LINK '%s' %s:%u\n", pos, - &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); - udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); - while (isspace(next[1])) - next++; - pos = &next[1]; - next = strchr(pos, ' '); - } - if (pos[0] != '\0') { - info(event->udev, "LINK '%s' %s:%u\n", pos, - &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); - udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); - } + info(event->udev, "%i character(s) replaced\n", count); } + free(event->name); + event->name = strdup(name_str); + info(event->udev, "NAME '%s' %s:%u\n", + event->name, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); break; - case TK_A_EVENT_TIMEOUT: - udev_device_set_event_timeout(event->dev, cur->key.event_timeout); - break; - case TK_A_ATTR: - { - const char *key_name = &rules->buf[cur->key.attr_off]; - char attr[UTIL_PATH_SIZE]; - char value[UTIL_NAME_SIZE]; - FILE *f; - - if (util_resolve_subsys_kernel(event->udev, key_name, attr, sizeof(attr), 0) != 0) - util_strscpyl(attr, sizeof(attr), udev_device_get_syspath(event->dev), "/", key_name, NULL); - attr_subst_subdir(attr, sizeof(attr)); - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], value, sizeof(value)); - info(event->udev, "ATTR '%s' writing '%s' %s:%u\n", attr, value, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - f = fopen(attr, "w"); - if (f != NULL) { - if (fprintf(f, "%s", value) <= 0) - err(event->udev, "error writing ATTR{%s}: %m\n", attr); - fclose(f); - } else { - err(event->udev, "error opening ATTR{%s} for writing: %m\n", attr); - } + } + case TK_A_DEVLINK: { + char temp[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + char *pos, *next; + int count = 0; + + if (event->devlink_final) break; - } - case TK_A_RUN: - { - struct udev_list_entry *list_entry; - - if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) - udev_list_cleanup_entries(event->udev, &event->run_list); - info(event->udev, "RUN '%s' %s:%u\n", - &rules->buf[cur->key.value_off], - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - list_entry = udev_list_entry_add(event->udev, &event->run_list, - &rules->buf[cur->key.value_off], NULL, 1, 0); - if (cur->key.fail_on_error) - udev_list_entry_set_flags(list_entry, 1); + if (major(udev_device_get_devnum(event->dev)) == 0) break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->devlink_final = true; + if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) + udev_device_cleanup_devlinks_list(event->dev); + + /* allow multiple symlinks separated by spaces */ + udev_event_apply_format(event, &rules->buf[cur->key.value_off], temp, sizeof(temp)); + if (esc == ESCAPE_UNSET) + count = util_replace_chars(temp, "/ "); + else if (esc == ESCAPE_REPLACE) + count = util_replace_chars(temp, "/"); + if (count > 0) + info(event->udev, "%i character(s) replaced\n" , count); + dbg(event->udev, "rule applied, added symlink(s) '%s'\n", temp); + pos = temp; + while (isspace(pos[0])) + pos++; + next = strchr(pos, ' '); + while (next != NULL) { + next[0] = '\0'; + info(event->udev, "LINK '%s' %s:%u\n", pos, + &rules->buf[rule->rule.filename_off], rule->rule.filename_line); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); + udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); + while (isspace(next[1])) + next++; + pos = &next[1]; + next = strchr(pos, ' '); + } + if (pos[0] != '\0') { + info(event->udev, "LINK '%s' %s:%u\n", pos, + &rules->buf[rule->rule.filename_off], rule->rule.filename_line); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); + udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); + } + break; + } + case TK_A_ATTR: { + const char *key_name = &rules->buf[cur->key.attr_off]; + char attr[UTIL_PATH_SIZE]; + char value[UTIL_NAME_SIZE]; + FILE *f; + + if (util_resolve_subsys_kernel(event->udev, key_name, attr, sizeof(attr), 0) != 0) + util_strscpyl(attr, sizeof(attr), udev_device_get_syspath(event->dev), "/", key_name, NULL); + attr_subst_subdir(attr, sizeof(attr)); + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], value, sizeof(value)); + info(event->udev, "ATTR '%s' writing '%s' %s:%u\n", attr, value, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + f = fopen(attr, "w"); + if (f != NULL) { + if (fprintf(f, "%s", value) <= 0) + err(event->udev, "error writing ATTR{%s}: %m\n", attr); + fclose(f); + } else { + err(event->udev, "error opening ATTR{%s} for writing: %m\n", attr); } + break; + } + case TK_A_RUN: { + if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) + udev_list_cleanup(&event->run_list); + info(event->udev, "RUN '%s' %s:%u\n", + &rules->buf[cur->key.value_off], + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + udev_list_entry_add(&event->run_list, &rules->buf[cur->key.value_off], NULL); + break; + } case TK_A_GOTO: if (cur->key.rule_goto == 0) break; @@ -2752,6 +2720,7 @@ void udev_rules_apply_static_dev_perms(struct udev_rules *rules) case TK_A_STATIC_NODE: { char filename[UTIL_PATH_SIZE]; struct stat stats; + /* we assure, that the permissions tokens are sorted before the static token */ if (mode == 0 && uid == 0 && gid == 0) goto next; @@ -2761,14 +2730,24 @@ void udev_rules_apply_static_dev_perms(struct udev_rules *rules) goto next; if (!S_ISBLK(stats.st_mode) && !S_ISCHR(stats.st_mode)) goto next; - if (mode != 0 && mode != (stats.st_mode & 0777)) { + if (mode == 0) { + if (gid > 0) + mode = 0660; + else + mode = 0600; + } + /* set sticky bit, so we do not remove the node on module unload */ + mode |= 01000; + if (mode != (stats.st_mode & 01777)) { chmod(filename, mode); info(rules->udev, "chmod '%s' %#o\n", filename, mode); } + if ((uid != 0 && uid != stats.st_uid) || (gid != 0 && gid != stats.st_gid)) { chown(filename, uid, gid); info(rules->udev, "chown '%s' %u %u\n", filename, uid, gid); } + utimensat(AT_FDCWD, filename, NULL, 0); break; } diff --git a/udev/udev-watch.c b/udev/udev-watch.c index f51a10d..0ec8bfd 100644 --- a/udev/udev-watch.c +++ b/udev/udev-watch.c @@ -54,8 +54,8 @@ void udev_watch_restore(struct udev *udev) if (inotify_fd < 0) return; - util_strscpyl(oldname, sizeof(oldname), udev_get_dev_path(udev), "/.udev/watch.old", NULL); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/watch", NULL); + util_strscpyl(oldname, sizeof(oldname), udev_get_run_path(udev), "/watch.old", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/watch", NULL); if (rename(filename, oldname) == 0) { DIR *dir; struct dirent *ent; @@ -118,7 +118,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev) return; } - snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd); + snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); util_create_path(udev, filename); unlink(filename); symlink(udev_device_get_id_filename(dev), filename); @@ -141,7 +141,7 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev) info(udev, "removing watch on '%s'\n", udev_device_get_devnode(dev)); inotify_rm_watch(inotify_fd, wd); - snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd); + snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); unlink(filename); udev_device_set_watch_handle(dev, -1); @@ -158,7 +158,7 @@ struct udev_device *udev_watch_lookup(struct udev *udev, int wd) if (inotify_fd < 0 || wd < 0) return NULL; - snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd); + snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); s = majmin; l = util_strpcpy(&s, sizeof(majmin), udev_get_sys_path(udev)); len = readlink(filename, s, l); diff --git a/udev/udev.7 b/udev/udev.7 index f601e9f..a918324 100644 --- a/udev/udev.7 +++ b/udev/udev.7 @@ -1,13 +1,22 @@ '\" t .\" Title: udev .\" Author: [see the "Author" section] -.\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 02/10/2011 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 10/19/2011 .\" Manual: udev .\" Source: udev .\" Language: English .\" -.TH "UDEV" "7" "02/10/2011" "udev" "udev" +.TH "UDEV" "7" "10/19/2011" "udev" "udev" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -26,17 +35,16 @@ udev supplies the system software with device events, manages permissions of dev /dev directory, or renames network interfaces\&. The kernel usually just assigns unpredictable device names based on the order of discovery\&. Meaningful symlinks or network device names provide a way to reliably identify devices based on their properties or current configuration\&. .PP -The udev daemon -\fBudevd\fR(8) -receives device uevents directly from the kernel whenever a device is added or removed from the system, or it changes its state\&. When udev receives a device event, it matches its configured set of rules against various device attributes to identify the device\&. Rules that match, may provide additional device information to be stored in the udev database, or information to be used to create meaningful symlink names\&. +The udev daemon, +\fBudevd\fR(8), receives device uevents directly from the kernel whenever a device is added or removed from the system, or it changes its state\&. When udev receives a device event, it matches its configured set of rules against various device attributes to identify the device\&. Rules that match may provide additional device information to be stored in the udev database or to be used to create meaningful symlink names\&. .PP -All device information udev processes, is stored in the udev database and sent out to possible event subscribers\&. Access to all stored data and the event sources are provided by the library libudev\&. +All device information udev processes is stored in the udev database and sent out to possible event subscribers\&. Access to all stored data and the event sources is provided by the library libudev\&. .SH "CONFIGURATION" .PP udev configuration files are placed in /etc/udev/ and -/lib/udev/\&. All empty lines, or lines beginning with \'#\' will be ignored\&. +/lib/udev/\&. All empty lines or lines beginning with \*(Aq#\*(Aq are ignored\&. .SS "Configuration file" .PP udev expects its main configuration file at @@ -62,19 +70,19 @@ The udev rules are read from the files located in the default rules directory /lib/udev/rules\&.d/, the custom rules directory /etc/udev/rules\&.d/ and the temporary rules directory -/dev/\&.udev/rules\&.d/\&. All rule files are sorted and processed in lexical order, regardless in which of these directories they live\&. Files in +/run/udev/rules\&.d/\&. All rule files are collectively sorted and processed in lexical order, regardless of the directories in which they live\&. However, files in /etc/udev/rules\&.d/ -have precedence over files with the same name in -/lib/udev/rules\&.d/\&. This can be used to ignore a default rules file if needed\&. +take precedence over files with the same name in +/lib/udev/rules\&.d/; this can be used to ignore a default rules file if needed\&. .PP -Rule files must end in -\&.rules, other extensions are ignored\&. +Rule files must have the extension +\&.rules; other extensions are ignored\&. .PP -Every line in the rules file contains at least one key value pair\&. There are two kind of keys, match and assignment keys\&. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned\&. +Every line in the rules file contains at least one key\-value pair\&. There are two kind of keys: match and assignment\&. If all match keys are matching against its value, the rule gets applied and the assignment keys get the specified value assigned\&. .PP A matching rule may rename a network interface, add symlinks pointing to the device node, or run a specified program as part of the event handling\&. .PP -A rule consists of a list of one or more key value pairs separated by a comma\&. Each key has a distinct operation, depending on the used operator\&. Valid operators are: +A rule consists of a comma\-separated list of one or more key\-value pairs\&. Each key has a distinct operation, depending on the used operator\&. Valid operators are: .PP \fB==\fR .RS 4 @@ -88,7 +96,7 @@ Compare for inequality\&. .PP \fB=\fR .RS 4 -Assign a value to a key\&. Keys that represent a list, are reset and only this single value is assigned\&. +Assign a value to a key\&. Keys that represent a list are reset and only this single value is assigned\&. .RE .PP \fB+=\fR @@ -98,7 +106,7 @@ Add the value to a key that holds a list of entries\&. .PP \fB:=\fR .RS 4 -Assign a value to a key finally; disallow any later changes, which may be used to prevent changes by any later rules\&. +Assign a value to a key finally; disallow any later changes\&. .RE .PP The following key names can be used to match against device properties\&. Some of the keys also match against properties of the parent devices in sysfs, not only the device that has generated the event\&. If multiple keys that match a parent device are specified in a single rule, all these keys must match at one and the same parent device\&. @@ -135,12 +143,12 @@ Match the subsystem of the event device\&. .PP \fBDRIVER\fR .RS 4 -Match the driver name of the event device\&. Only set for devices which are bound to a driver at the time the event is generated\&. +Match the driver name of the event device\&. Only set this key for devices which are bound to a driver at the time the event is generated\&. .RE .PP \fBATTR{\fR\fB\fIfilename\fR\fR\fB}\fR .RS 4 -Match sysfs attribute values of the event device\&. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself\&. +Match sysfs attribute values of the event device\&. Trailing whitespace in the attribute values is ignored unless the specified match value itself contains trailing whitespace\&. .RE .PP \fBKERNELS\fR @@ -162,7 +170,12 @@ Search the devpath upwards for a matching device driver name\&. .RS 4 Search the devpath upwards for a device with matching sysfs attribute values\&. If multiple \fBATTRS\fR -matches are specified, all of them must match on the same device\&. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself\&. +matches are specified, all of them must match on the same device\&. Trailing whitespace in the attribute values is ignored unless the specified match value itself contains trailing whitespace\&. +.RE +.PP +\fBTAGS\fR +.RS 4 +Search the devpath upwards for a device with matching tag\&. .RE .PP \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR @@ -182,7 +195,7 @@ Test the existence of a file\&. An octal mode mask can be specified if needed\&. .PP \fBPROGRAM\fR .RS 4 -Execute a program\&. The key is true, if the program returns successfully\&. The device properties are made available to the executed program in the environment\&. The program\'s output printed to stdout, is available in the RESULT key\&. +Execute a program to determine whether there is a match; the key is true if the program returns successfully\&. The device properties are made available to the executed program in the environment\&. The program\*(Aqs stdout is available in the RESULT key\&. .RE .PP \fBRESULT\fR @@ -190,11 +203,11 @@ Execute a program\&. The key is true, if the program returns successfully\&. The Match the returned string of the last PROGRAM call\&. This key can be used in the same or in any later rule after a PROGRAM call\&. .RE .PP -Most of the fields support a shell style pattern matching\&. The following pattern characters are supported: +Most of the fields support shell\-style pattern matching\&. The following pattern characters are supported: .PP \fB*\fR .RS 4 -Matches zero, or any number of characters\&. +Matches zero or more characters\&. .RE .PP \fB?\fR @@ -204,19 +217,21 @@ Matches any single character\&. .PP \fB[]\fR .RS 4 -Matches any single character specified within the brackets\&. For example, the pattern string \'tty[SR]\' would match either \'ttyS\' or \'ttyR\'\&. Ranges are also supported within this match with the \'\-\' character\&. For example, to match on the range of all digits, the pattern [0\-9] would be used\&. If the first character following the \'[\' is a \'!\', any characters not enclosed are matched\&. +Matches any single character specified within the brackets\&. For example, the pattern string \*(Aqtty[SR]\*(Aq would match either \*(AqttyS\*(Aq or \*(AqttyR\*(Aq\&. Ranges are also supported via the \*(Aq\-\*(Aq character\&. For example, to match on the range of all digits, the pattern [0\-9] could be used\&. If the first character following the \*(Aq[\*(Aq is a \*(Aq!\*(Aq, any characters not enclosed are matched\&. .RE .PP The following keys can get values assigned: .PP \fBNAME\fR .RS 4 -The name, a network interface should be renamed to\&. Or as a temporary workaround, the name a device node should be named\&. Usually the kernel provides the defined node name, or even creates and removes the node before udev even receives any event\&. Changing the node name from the kernel\'s default creates inconsistencies and is not supported\&. If the kernel and NAME specify different names, an error will be logged\&. Udev is only expected to handle device node permissions and to create additional symlinks, not to change kernel\-provided device node names\&. Instead of renaming a device node, SYMLINK should be used\&. Symlink names must never conflict with device node names, it will result in unpredictable behavior\&. +What a network interface should be named\&. +.sp +Also, as a temporary workaround, this is what a device node should be named; usually the kernel provides the defined node name or creates and removes the node before udev even receives any event\&. Changing the node name from the kernel\*(Aqs default creates inconsistencies and is not supported\&. If the kernel and NAME specify different names, an error is logged\&. udev is only expected to handle device node permissions and to create additional symlinks, not to change kernel\-provided device node names\&. Instead of renaming a device node, SYMLINK should be used\&. However, symlink names must never conflict with device node names, as that would result in unpredictable behavior\&. .RE .PP \fBSYMLINK\fR .RS 4 -The name of a symlink targeting the node\&. Every matching rule will add this value to the list of symlinks to be created\&. Multiple symlinks may be specified by separating the names by the space character\&. In case multiple devices claim the same name, the link will always point to the device with the highest link_priority\&. If the current device goes away, the links will be re\-evaluated and the device with the next highest link_priority will own the link\&. If no link_priority is specified, the order of the devices, and which one of them will own the link, is undefined\&. Claiming the same name for a symlink, which is or might be used for a device node, may result in unexpected behavior and is not supported\&. +The name of a symlink targeting the node\&. Every matching rule adds this value to the list of symlinks to be created\&. Multiple symlinks may be specified by separating the names by the space character\&. In case multiple devices claim the same name, the link always points to the device with the highest link_priority\&. If the current device goes away, the links are re\-evaluated and the device with the next highest link_priority becomes the owner of the link\&. If no link_priority is specified, the order of the devices (and which one of them owns the link) is undefined\&. Also, symlink names must never conflict with the kernel\*(Aqs default device node names, as that would result in unpredictable behavior\&. .RE .PP \fBOWNER, GROUP, MODE\fR @@ -231,32 +246,30 @@ The value that should be written to a sysfs attribute of the event device\&. .PP \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR .RS 4 -Set a device property value\&. Property names with a leading \'\&.\' are not stored in the database or exported to external tool or events\&. +Set a device property value\&. Property names with a leading \*(Aq\&.\*(Aq are neither stored in the database nor exported to events or external tools (run by, say, the PROGRAM match key)\&. .RE .PP \fBTAG\fR .RS 4 -Attach a tag to a device\&. This is used to filter events for users of libudev\'s monitor functionality, or to enumerate a group of tagged devices\&. The implementation can only work efficiently if only a few tags are attached to a device\&. It is only meant to be used in contexts with specific device filter requirements, and not as a general\-purpose flag\&. Excessive use might result in inefficient event handling\&. +Attach a tag to a device\&. This is used to filter events for users of libudev\*(Aqs monitor functionality, or to enumerate a group of tagged devices\&. The implementation can only work efficiently if only a few tags are attached to a device\&. It is only meant to be used in contexts with specific device filter requirements, and not as a general\-purpose flag\&. Excessive use might result in inefficient event handling\&. .RE .PP \fBRUN\fR .RS 4 -Add a program to the list of programs to be executed for a specific device\&. This can only be used for very short running tasks\&. Running an event process for a long period of time may block all further events for this or a dependent device\&. Long running tasks need to be immediately detached from the event process itself\&. If the option -\fBRUN{\fR\fB\fIfail_event_on_error\fR\fR\fB}\fR -is specified, and the executed program returns non\-zero, the event will be marked as failed for a possible later handling\&. +Add a program to the list of programs to be executed for a specific device\&. This can only be used for very short running tasks\&. Running an event process for a long period of time may block all further events for this or a dependent device\&. Long running tasks need to be immediately detached from the event process itself\&. .sp -If no absolute path is given, the program is expected to live in -/lib/udev, otherwise the absolute path must be specified\&. Program name and arguments are separated by spaces\&. Single quotes can be used to specify arguments with spaces\&. +If no absolute path is given, the program is expected to live in the directory provided at compile\-time to configure via \-\-libexecdir (this is usually +/lib/udev), otherwise the absolute path must be specified\&. The program name and following arguments are separated by spaces\&. Single quotes can be used to specify arguments with spaces\&. .RE .PP \fBLABEL\fR .RS 4 -Named label where a GOTO can jump to\&. +A named label to which a GOTO may jump\&. .RE .PP \fBGOTO\fR .RS 4 -Jumps to the next LABEL with a matching name +Jumps to the next LABEL with a matching name\&. .RE .PP \fBIMPORT{\fR\fB\fItype\fR\fR\fB}\fR @@ -272,7 +285,7 @@ Execute an external program specified as the assigned value and import its outpu .PP \fBfile\fR .RS 4 -Import a text file specified as the assigned value, which must be in environment key format\&. +Import a text file specified as the assigned value, the content of which must be in environment key format\&. .RE .PP \fBdb\fR @@ -282,7 +295,7 @@ Import a single property specified as the assigned value from the current device .PP \fBcmdline\fR .RS 4 -Import a single property from the kernel commandline\&. For simple flags the value of the property will be set to \'1\'\&. +Import a single property from the kernel command line\&. For simple flags the value of the property is set to \*(Aq1\*(Aq\&. .RE .PP \fBparent\fR @@ -291,17 +304,11 @@ Import the stored keys from the parent device by reading the database entry of t \fBIMPORT{parent}\fR is used as a filter of key names to import (with the same shell\-style pattern matching used for comparisons)\&. .RE -.sp -If no option is given, udev will choose between -\fBprogram\fR -and -\fBfile\fR -based on the executable bit of the file permissions\&. .RE .PP \fBWAIT_FOR\fR .RS 4 -Wait for a file to become available or until a 10 seconds timeout expires\&. The path is relative to the sysfs device, i\&. e\&. if no path is specified this waits for an attribute to appear\&. +Wait for a file to become available or until a timeout of 10 seconds expires\&. The path is relative to the sysfs device; if no path is specified, this waits for an attribute to appear\&. .RE .PP \fBOPTIONS\fR @@ -315,7 +322,7 @@ Specify the priority of the created symlinks\&. Devices with higher priorities o .PP \fBevent_timeout=\fR .RS 4 -Number of seconds an event will wait for operations to finish, before it will terminate itself\&. +Number of seconds an event waits for operations to finish before giving up and terminating itself\&. .RE .PP \fBstring_escape=\fR\fB\fInone|replace\fR\fR @@ -325,13 +332,13 @@ Usually control and other possibly unsafe characters are replaced in strings use .PP \fBstatic_node=\fR .RS 4 -Apply the permissions specified in this rule to a static device node with the specified name\&. Static device nodes might be provided by kernel modules, or copied from -/lib/udev/devices\&. These nodes might not have a corresponding kernel device at the time udevd is started, and allow to trigger automatic kernel module on\-demand loading\&. +Apply the permissions specified in this rule to the static device node with the specified name\&. Static device nodes might be provided by kernel modules or copied from +/lib/udev/devices\&. These nodes might not have a corresponding kernel device at the time udevd is started; they can trigger automatic kernel module loading\&. .RE .PP \fBwatch\fR .RS 4 -Watch the device node with inotify, when closed after being opened for writing, a change uevent will be synthesised\&. +Watch the device node with inotify; when the node is closed after being opened for writing, a change uevent is synthesized\&. .RE .PP \fBnowatch\fR @@ -349,9 +356,9 @@ The \fBMODE\fR and \fBRUN\fR -fields support simple printf\-like string substitutions\&. The +fields support simple string substitutions\&. The \fBRUN\fR -format chars gets applied after all rules have been processed, right before the program is executed\&. It allows the use of device properties set by earlier matching rules\&. For all other fields, substitutions are applied while the individual rule is being processed\&. The available substitutions are: +substitutions are performed after all rules have been processed, right before the program is executed, allowing for the use of device properties set by earlier matching rules\&. For all other fields, substitutions are performed while the individual rule is being processed\&. The available substitutions are: .PP \fB$kernel\fR, \fB%k\fR .RS 4 @@ -360,7 +367,7 @@ The kernel name for this device\&. .PP \fB$number\fR, \fB%n\fR .RS 4 -The kernel number for this device\&. For example, \'sda3\' has kernel number of \'3\' +The kernel number for this device\&. For example, \*(Aqsda3\*(Aq has kernel number of \*(Aq3\*(Aq .RE .PP \fB$devpath\fR, \fB%p\fR @@ -390,7 +397,9 @@ and .PP \fB$attr{\fR\fB\fIfile\fR\fR\fB}\fR, \fB%s{\fR\fB\fIfile\fR\fR\fB}\fR .RS 4 -The value of a sysfs attribute found at the device, where all keys of the rule have matched\&. If the matching device does not have such an attribute, and a previous KERNELS, SUBSYSTEMS, DRIVERS, or ATTRS test selected a parent device, use the attribute from that parent device\&. If the attribute is a symlink, the last element of the symlink target is returned as the value\&. +The value of a sysfs attribute found at the device where all keys of the rule have matched\&. If the matching device does not have such an attribute, and a previous KERNELS, SUBSYSTEMS, DRIVERS, or ATTRS test selected a parent device, then the attribute from that parent device is used\&. +.sp +If the attribute is a symlink, the last element of the symlink target is returned as the value\&. .RE .PP \fB$env{\fR\fB\fIkey\fR\fR\fB}\fR, \fB%E{\fR\fB\fIkey\fR\fR\fB}\fR @@ -410,8 +419,8 @@ The kernel minor number for the device\&. .PP \fB$result\fR, \fB%c\fR .RS 4 -The string returned by the external program requested with PROGRAM\&. A single part of the string, separated by a space character may be selected by specifying the part number as an attribute: -\fB%c{N}\fR\&. If the number is followed by the \'+\' char this part plus all remaining parts of the result string are substituted: +The string returned by the external program requested with PROGRAM\&. A single part of the string, separated by a space character, may be selected by specifying the part number as an attribute: +\fB%c{N}\fR\&. If the number is followed by the \*(Aq+\*(Aq character, this part plus all remaining parts of the result string are substituted: \fB%c{N+}\fR .RE .PP @@ -427,7 +436,7 @@ The current name of the device node\&. If not changed by a rule, it is the name .PP \fB$links\fR .RS 4 -The current list of symlinks, separated by a space character\&. The value is only set if an earlier rule assigned a value, or during a remove events\&. +A space\-separated list of the current symlinks\&. The value is only set during a remove event or if an earlier rule assigned a value\&. .RE .PP \fB$root\fR, \fB%r\fR @@ -442,17 +451,17 @@ The sysfs mount point\&. .PP \fB$tempnode\fR, \fB%N\fR .RS 4 -The name of a created temporary device node to provide access to the device from a external program before the real node is created\&. +The name of a temporary device node created to provide access to the device from a external program before the real node is created\&. .RE .PP \fB%%\fR .RS 4 -The \'%\' character itself\&. +The \*(Aq%\*(Aq character itself\&. .RE .PP \fB$$\fR .RS 4 -The \'$\' character itself\&. +The \*(Aq$\*(Aq character itself\&. .RE .SH "AUTHOR" .PP diff --git a/udev/udev.h b/udev/udev.h index f20f370..eaba4ed 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -26,11 +26,6 @@ #include "libudev.h" #include "libudev-private.h" -#define DEFAULT_FAKE_PARTITIONS_COUNT 15 -#define UDEV_EVENT_TIMEOUT 180 - -#define UDEV_CTRL_SOCK_PATH "@/org/kernel/udev/udevd" - struct udev_event { struct udev *udev; struct udev_device *dev; @@ -42,15 +37,21 @@ struct udev_event { mode_t mode; uid_t uid; gid_t gid; - char *smack; - struct udev_list_node run_list; + struct udev_list run_list; int exec_delay; + unsigned long long birth_usec; + unsigned long long timeout_usec; + int fd_signal; + unsigned int builtin_run; + unsigned int builtin_ret; + bool sigterm; bool inotify_watch; bool inotify_watch_final; bool group_final; bool owner_final; - bool smack_final; + bool mode_set; bool mode_final; + bool static_node; bool name_final; bool devlink_final; bool run_final; @@ -66,17 +67,20 @@ struct udev_watch { struct udev_rules; struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names); void udev_rules_unref(struct udev_rules *rules); -int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event); +int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, const sigset_t *sigmask); void udev_rules_apply_static_dev_perms(struct udev_rules *rules); /* udev-event.c */ struct udev_event *udev_event_new(struct udev_device *dev); void udev_event_unref(struct udev_event *event); -int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules); -int udev_event_execute_run(struct udev_event *event, const sigset_t *sigset); size_t udev_event_apply_format(struct udev_event *event, const char *src, char *dest, size_t size); int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string, char *result, size_t maxsize, int read_value); +int udev_event_spawn(struct udev_event *event, + const char *cmd, char **envp, const sigset_t *sigmask, + char *result, size_t ressize); +int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigset); +int udev_event_execute_run(struct udev_event *event, const sigset_t *sigset); /* udev-watch.c */ int udev_watch_init(struct udev *udev); @@ -86,16 +90,80 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev); struct udev_device *udev_watch_lookup(struct udev *udev, int wd); /* udev-node.c */ -int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_t uid, gid_t gid, const char *smack); -int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid, const char *smack); +int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_t uid, gid_t gid); +int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid); int udev_node_remove(struct udev_device *dev); void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old); +/* udev-ctrl.c */ +struct udev_ctrl; +struct udev_ctrl *udev_ctrl_new(struct udev *udev); +struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd); +int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl); +struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl); +struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl); +int udev_ctrl_cleanup(struct udev_ctrl *uctrl); +struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl); +int udev_ctrl_get_fd(struct udev_ctrl *uctrl); +int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout); +int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout); +int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count, int timeout); +struct udev_ctrl_connection; +struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl); +struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn); +struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn); +struct udev_ctrl_msg; +struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn); +struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg); +struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg); +const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg); + /* udevadm commands */ -int udevadm_monitor(struct udev *udev, int argc, char *argv[]); -int udevadm_info(struct udev *udev, int argc, char *argv[]); -int udevadm_control(struct udev *udev, int argc, char *argv[]); -int udevadm_trigger(struct udev *udev, int argc, char *argv[]); -int udevadm_settle(struct udev *udev, int argc, char *argv[]); -int udevadm_test(struct udev *udev, int argc, char *argv[]); +struct udevadm_cmd { + const char *name; + int (*cmd)(struct udev *udev, int argc, char *argv[]); + const char *help; + int debug; +}; +extern const struct udevadm_cmd udevadm_monitor; +extern const struct udevadm_cmd udevadm_info; +extern const struct udevadm_cmd udevadm_control; +extern const struct udevadm_cmd udevadm_trigger; +extern const struct udevadm_cmd udevadm_settle; +extern const struct udevadm_cmd udevadm_test; +extern const struct udevadm_cmd udevadm_test_builtin; + +/* built-in commands */ +enum udev_builtin_cmd { + UDEV_BUILTIN_PATH_ID, + UDEV_BUILTIN_USB_ID, + UDEV_BUILTIN_INPUT_ID, + UDEV_BUILTIN_MODALIAS_MATCH, + UDEV_BUILTIN_MAX +}; +struct udev_builtin { + const char *name; + int (*cmd)(struct udev_device *dev, bool test); + const char *help; +}; +extern const struct udev_builtin udev_builtin_path_id; +extern const struct udev_builtin udev_builtin_usb_id; +extern const struct udev_builtin udev_builtin_input_id; +enum udev_builtin_cmd udev_builtin_lookup(const char *name); +const char *udev_builtin_name(enum udev_builtin_cmd cmd); +int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, bool test); +int udev_builtin_list(struct udev *udev); +int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val, ...); #endif diff --git a/udev/udev.html b/udev/udev.html index de6de98..6190496 100644 --- a/udev/udev.html +++ b/udev/udev.html @@ -1,43 +1,42 @@ -udev

Name

udev — Linux dynamic device management

Description

udev supplies the system software with device events, manages permissions +udev

Name

udev — Linux dynamic device management

Configuration

udev configuration files are placed in /etc/udev/ - and /lib/udev/. All empty lines, or lines beginning with - '#' will be ignored.

Rules files

The udev rules are read from the files located in the default rules directory /lib/udev/rules.d/, the custom rules directory /etc/udev/rules.d/ - and the temporary rules directory /dev/.udev/rules.d/. - All rule files are sorted and processed in lexical order, regardless - in which of these directories they live. Files in - /etc/udev/rules.d/ have precedence over files with - the same name in /lib/udev/rules.d/. This can be - used to ignore a default rules file if needed.

Rule files must end in .rules, other extensions - are ignored.

Every line in the rules file contains at least one key value pair. - There are two kind of keys, match and assignment keys. + and the temporary rules directory /run/udev/rules.d/. + All rule files are collectively sorted and processed in lexical order, + regardless of the directories in which they live. However, files in + /etc/udev/rules.d/ take precedence over files with + the same name in /lib/udev/rules.d/; this can be + used to ignore a default rules file if needed.

Rule files must have the extension .rules; other + extensions are ignored.

Every line in the rules file contains at least one key-value pair. + There are two kind of keys: match and assignment. If all match keys are matching against its value, the rule gets applied and the - assign keys get the specified value assigned.

A matching rule may rename a network interface, add symlinks + assignment keys get the specified value assigned.

A matching rule may rename a network interface, add symlinks pointing to the device node, or run a specified program as part of - the event handling.

A rule consists of a list of one or more key value pairs separated by - a comma. Each key has a distinct operation, depending on the used operator. Valid - operators are:

==

Compare for equality.

!=

Compare for inequality.

=

Assign a value to a key. Keys that represent a list, are reset - and only this single value is assigned.

+=

Add the value to a key that holds a list of entries.

:=

Assign a value to a key finally; disallow any later changes, - which may be used to prevent changes by any later rules.

The following key names can be used to match against device properties. + the event handling.

A rule consists of a comma-separated list of one or more key-value pairs. + Each key has a distinct operation, depending on the used operator. Valid + operators are:

==

Compare for equality.

!=

Compare for inequality.

=

Assign a value to a key. Keys that represent a list are reset + and only this single value is assigned.

+=

Add the value to a key that holds a list of entries.

:=

Assign a value to a key finally; disallow any later changes.

The following key names can be used to match against device properties. Some of the keys also match against properties of the parent devices in sysfs, not only the device that has generated the event. If multiple keys that match a parent device are specified in a single rule, all these keys must match at @@ -46,48 +45,49 @@ rules.

SYMLINK

Match the name of a symlink targeting the node. It can be used once a SYMLINK key has been set in one of the preceding rules. There may be multiple symlinks; only one needs to match. -

SUBSYSTEM

Match the subsystem of the event device.

DRIVER

Match the driver name of the event device. Only set for devices +

SUBSYSTEM

Match the subsystem of the event device.

DRIVER

Match the driver name of the event device. Only set this key for devices which are bound to a driver at the time the event is generated.

ATTR{filename}

Match sysfs attribute values of the event device. Trailing - whitespace in the attribute values is ignored, if the specified match - value does not contain trailing whitespace itself. + whitespace in the attribute values is ignored unless the specified match + value itself contains trailing whitespace.

KERNELS

Search the devpath upwards for a matching device name.

SUBSYSTEMS

Search the devpath upwards for a matching device subsystem name.

DRIVERS

Search the devpath upwards for a matching device driver name.

ATTRS{filename}

Search the devpath upwards for a device with matching sysfs attribute values. If multiple ATTRS matches are specified, all of them - must match on the same device. Trailing whitespace in the attribute values is ignored, - if the specified match value does not contain trailing whitespace itself.

ENV{key}

Match against a device property value.

TAG

Match against a device tag.

TEST{octal mode mask}

Test the existence of a file. An octal mode mask can be specified - if needed.

PROGRAM

Execute a program. The key is true, if the program returns + must match on the same device. Trailing whitespace in the attribute values is ignored + unless the specified match value itself contains trailing whitespace.

TAGS

Search the devpath upwards for a device with matching tag.

ENV{key}

Match against a device property value.

TAG

Match against a device tag.

TEST{octal mode mask}

Test the existence of a file. An octal mode mask can be specified + if needed.

PROGRAM

Execute a program to determine whether there + is a match; the key is true if the program returns successfully. The device properties are made available to the - executed program in the environment. The program's output printed to - stdout, is available in the RESULT key.

RESULT

Match the returned string of the last PROGRAM call. This key can - be used in the same or in any later rule after a PROGRAM call.

Most of the fields support a shell style pattern matching. The following - pattern characters are supported:

Most of the fields support shell-style pattern matching. The following + pattern characters are supported:

The following keys can get values assigned:

The following keys can get values assigned:

NAME

What a network interface should be named.

Also, as a temporary workaround, this is what a device node + should be named; usually the kernel provides the defined node name or creates and removes the node before udev even receives any event. Changing the node name from the kernel's default creates inconsistencies and is not supported. If the kernel and NAME specify different names, - an error will be logged. Udev is only expected to handle device node + an error is logged. udev is only expected to handle device node permissions and to create additional symlinks, not to change kernel-provided device node names. Instead of renaming a device node, - SYMLINK should be used. Symlink names must never conflict with - device node names, it will result in unpredictable behavior.

SYMLINK

The name of a symlink targeting the node. Every matching rule will add + SYMLINK should be used. However, symlink names must never conflict with + device node names, as that would result in unpredictable behavior.

SYMLINK

The name of a symlink targeting the node. Every matching rule adds this value to the list of symlinks to be created. Multiple symlinks may be specified by separating the names by the space character. In case multiple - devices claim the same name, the link will always point to the device with - the highest link_priority. If the current device goes away, the links will - be re-evaluated and the device with the next highest link_priority will own - the link. If no link_priority is specified, the order of the devices, and - which one of them will own the link, is undefined. Claiming the same name for - a symlink, which is or might be used for a device node, may result in - unexpected behavior and is not supported. + devices claim the same name, the link always points to the device with + the highest link_priority. If the current device goes away, the links are + re-evaluated and the device with the next highest link_priority becomes the owner of + the link. If no link_priority is specified, the order of the devices (and + which one of them owns the link) is undefined. Also, symlink names must + never conflict with the kernel's default device node names, as that would + result in unpredictable behavior.

OWNER, GROUP, MODE

The permissions for the device node. Every specified value overwrites the compiled-in default value.

ATTR{key}

The value that should be written to a sysfs attribute of the event device.

ENV{key}

Set a device property value. Property names with a leading '.' - are not stored in the database or exported to external tool or events.

TAG

Attach a tag to a device. This is used to filter events for users + are neither stored in the database nor exported to events or + external tools (run by, say, the PROGRAM match key).

TAG

Attach a tag to a device. This is used to filter events for users of libudev's monitor functionality, or to enumerate a group of tagged devices. The implementation can only work efficiently if only a few tags are attached to a device. It is only meant to be used in @@ -97,62 +97,58 @@ device. This can only be used for very short running tasks. Running an event process for a long period of time may block all further events for this or a dependent device. Long running tasks need to be immediately - detached from the event process itself. If the option - RUN{fail_event_on_error} is - specified, and the executed program returns non-zero, the event will be - marked as failed for a possible later handling.

If no absolute path is given, the program is expected to live in - /lib/udev, otherwise the absolute path must be - specified. Program name and arguments are separated by spaces. Single quotes - can be used to specify arguments with spaces.

LABEL

Named label where a GOTO can jump to.

GOTO

Jumps to the next LABEL with a matching name

IMPORT{type}

Import a set of variables as device properties, + detached from the event process itself.

If no absolute path is given, the program is expected to live in + the directory provided at compile-time to configure via --libexecdir + (this is usually /lib/udev), otherwise the absolute + path must be specified. The program name and following arguments are + separated by spaces. Single quotes can be used to specify arguments with + spaces.

LABEL

A named label to which a GOTO may jump.

GOTO

Jumps to the next LABEL with a matching name.

IMPORT{type}

Import a set of variables as device properties, depending on type:

If no option is given, udev will choose between program - and file based on the executable bit of the file - permissions.

WAIT_FOR

Wait for a file to become available or until a 10 - seconds timeout expires. The path is relative to the sysfs device, - i. e. if no path is specified this waits for an attribute to appear.

OPTIONS

Rule and device options:

WAIT_FOR

Wait for a file to become available or until a timeout of + 10 seconds expires. The path is relative to the sysfs device; + if no path is specified, this waits for an attribute to appear.

OPTIONS

Rule and device options:

The NAME, SYMLINK, PROGRAM, + a corresponding kernel device at the time udevd is started; they can trigger + automatic kernel module loading.

watch

Watch the device node with inotify; when the node is closed after being opened for + writing, a change uevent is synthesized.

nowatch

Disable the watching of a device node with inotify.

The NAME, SYMLINK, PROGRAM, OWNER, GROUP, MODE and RUN - fields support simple printf-like string substitutions. The RUN - format chars gets applied after all rules have been processed, right before the program - is executed. It allows the use of device properties set by earlier matching - rules. For all other fields, substitutions are applied while the individual rule is + fields support simple string substitutions. The RUN + substitutions are performed after all rules have been processed, right before the program + is executed, allowing for the use of device properties set by earlier matching + rules. For all other fields, substitutions are performed while the individual rule is being processed. The available substitutions are:

$kernel, %k

The kernel name for this device.

$number, %n

The kernel number for this device. For example, 'sda3' has kernel number of '3'

$devpath, %p

The devpath of the device.

$id, %b

The name of the device matched while searching the devpath upwards for SUBSYSTEMS, KERNELS, DRIVERS and ATTRS.

$driver

The driver name of the device matched while searching the devpath upwards for SUBSYSTEMS, KERNELS, DRIVERS and ATTRS. -

$attr{file}, %s{file}

The value of a sysfs attribute found at the device, where +

$attr{file}, %s{file}

The value of a sysfs attribute found at the device where all keys of the rule have matched. If the matching device does not have such an attribute, and a previous KERNELS, SUBSYSTEMS, DRIVERS, or - ATTRS test selected a parent device, use the attribute from that - parent device. - If the attribute is a symlink, the last element of the symlink target is + ATTRS test selected a parent device, then the attribute from that + parent device is used.

If the attribute is a symlink, the last element of the symlink target is returned as the value.

$env{key}, %E{key}

A device property value.

$major, %M

The kernel major number for the device.

$minor, %m

The kernel minor number for the device.

$result, %c

The string returned by the external program requested with PROGRAM. - A single part of the string, separated by a space character may be selected + A single part of the string, separated by a space character, may be selected by specifying the part number as an attribute: %c{N}. - If the number is followed by the '+' char this part plus all remaining parts + If the number is followed by the '+' character, this part plus all remaining parts of the result string are substituted: %c{N+}

$parent, %P

The node name of the parent device.

$name

The current name of the device node. If not changed by a rule, it is the - name of the kernel device.

$links

The current list of symlinks, separated by a space character. The value is - only set if an earlier rule assigned a value, or during a remove events.

$root, %r

The udev_root value.

$sys, %S

The sysfs mount point.

$tempnode, %N

The name of a created temporary device node to provide access to - the device from a external program before the real node is created.

%%

The '%' character itself.

$$

The '$' character itself.

Author

Written by Greg Kroah-Hartman and + name of the kernel device.

$links

A space-separated list of the current symlinks. The value is + only set during a remove event or if an earlier rule assigned a value.

$root, %r

The udev_root value.

$sys, %S

The sysfs mount point.

$tempnode, %N

The name of a temporary device node created to provide access to + the device from a external program before the real node is created.

%%

The '%' character itself.

$$

The '$' character itself.

Author

Written by Greg Kroah-Hartman and Kay Sievers . With much help from - Dan Stekloff and many others.

diff --git a/udev/udev.xml b/udev/udev.xml index 3ef4103..a785348 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -27,23 +27,23 @@ names provide a way to reliably identify devices based on their properties or current configuration. - The udev daemon udevd - 8 receives device uevents directly from + The udev daemon, udevd + 8, receives device uevents directly from the kernel whenever a device is added or removed from the system, or it changes its state. When udev receives a device event, it matches its configured set of rules - against various device attributes to identify the device. Rules that match, may - provide additional device information to be stored in the udev database, or information + against various device attributes to identify the device. Rules that match may + provide additional device information to be stored in the udev database or to be used to create meaningful symlink names. - All device information udev processes, is stored in the udev database and + All device information udev processes is stored in the udev database and sent out to possible event subscribers. Access to all stored data and the event - sources are provided by the library libudev. + sources is provided by the library libudev. Configuration udev configuration files are placed in /etc/udev/ - and /lib/udev/. All empty lines, or lines beginning with - '#' will be ignored. + and /lib/udev/. All empty lines or lines beginning with + '#' are ignored. Configuration file udev expects its main configuration file at /etc/udev/udev.conf. @@ -73,27 +73,27 @@ The udev rules are read from the files located in the default rules directory /lib/udev/rules.d/, the custom rules directory /etc/udev/rules.d/ - and the temporary rules directory /dev/.udev/rules.d/. - All rule files are sorted and processed in lexical order, regardless - in which of these directories they live. Files in - /etc/udev/rules.d/ have precedence over files with - the same name in /lib/udev/rules.d/. This can be + and the temporary rules directory /run/udev/rules.d/. + All rule files are collectively sorted and processed in lexical order, + regardless of the directories in which they live. However, files in + /etc/udev/rules.d/ take precedence over files with + the same name in /lib/udev/rules.d/; this can be used to ignore a default rules file if needed. - Rule files must end in .rules, other extensions - are ignored. + Rule files must have the extension .rules; other + extensions are ignored. - Every line in the rules file contains at least one key value pair. - There are two kind of keys, match and assignment keys. + Every line in the rules file contains at least one key-value pair. + There are two kind of keys: match and assignment. If all match keys are matching against its value, the rule gets applied and the - assign keys get the specified value assigned. + assignment keys get the specified value assigned. A matching rule may rename a network interface, add symlinks pointing to the device node, or run a specified program as part of the event handling. - A rule consists of a list of one or more key value pairs separated by - a comma. Each key has a distinct operation, depending on the used operator. Valid + A rule consists of a comma-separated list of one or more key-value pairs. + Each key has a distinct operation, depending on the used operator. Valid operators are: @@ -113,7 +113,7 @@ - Assign a value to a key. Keys that represent a list, are reset + Assign a value to a key. Keys that represent a list are reset and only this single value is assigned. @@ -128,8 +128,7 @@ - Assign a value to a key finally; disallow any later changes, - which may be used to prevent changes by any later rules. + Assign a value to a key finally; disallow any later changes. @@ -189,7 +188,7 @@ - Match the driver name of the event device. Only set for devices + Match the driver name of the event device. Only set this key for devices which are bound to a driver at the time the event is generated. @@ -197,8 +196,8 @@ Match sysfs attribute values of the event device. Trailing - whitespace in the attribute values is ignored, if the specified match - value does not contain trailing whitespace itself. + whitespace in the attribute values is ignored unless the specified match + value itself contains trailing whitespace. @@ -229,8 +228,15 @@ Search the devpath upwards for a device with matching sysfs attribute values. If multiple matches are specified, all of them - must match on the same device. Trailing whitespace in the attribute values is ignored, - if the specified match value does not contain trailing whitespace itself. + must match on the same device. Trailing whitespace in the attribute values is ignored + unless the specified match value itself contains trailing whitespace. + + + + + + + Search the devpath upwards for a device with matching tag. @@ -259,10 +265,11 @@ - Execute a program. The key is true, if the program returns + Execute a program to determine whether there + is a match; the key is true if the program returns successfully. The device properties are made available to the - executed program in the environment. The program's output printed to - stdout, is available in the RESULT key. + executed program in the environment. The program's stdout + is available in the RESULT key. @@ -275,13 +282,13 @@ - Most of the fields support a shell style pattern matching. The following + Most of the fields support shell-style pattern matching. The following pattern characters are supported: - Matches zero, or any number of characters. + Matches zero or more characters. @@ -295,8 +302,8 @@ Matches any single character specified within the brackets. For example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. - Ranges are also supported within this match with the '-' character. - For example, to match on the range of all digits, the pattern [0-9] would + Ranges are also supported via the '-' character. + For example, to match on the range of all digits, the pattern [0-9] could be used. If the first character following the '[' is a '!', any characters not enclosed are matched. @@ -308,33 +315,33 @@ - The name, a network interface should be renamed to. Or as - a temporary workaround, the name a device node should be named. - Usually the kernel provides the defined node name, or even creates + What a network interface should be named. + Also, as a temporary workaround, this is what a device node + should be named; usually the kernel provides the defined node name or creates and removes the node before udev even receives any event. Changing the node name from the kernel's default creates inconsistencies and is not supported. If the kernel and NAME specify different names, - an error will be logged. Udev is only expected to handle device node + an error is logged. udev is only expected to handle device node permissions and to create additional symlinks, not to change kernel-provided device node names. Instead of renaming a device node, - SYMLINK should be used. Symlink names must never conflict with - device node names, it will result in unpredictable behavior. + SYMLINK should be used. However, symlink names must never conflict with + device node names, as that would result in unpredictable behavior. - The name of a symlink targeting the node. Every matching rule will add + The name of a symlink targeting the node. Every matching rule adds this value to the list of symlinks to be created. Multiple symlinks may be specified by separating the names by the space character. In case multiple - devices claim the same name, the link will always point to the device with - the highest link_priority. If the current device goes away, the links will - be re-evaluated and the device with the next highest link_priority will own - the link. If no link_priority is specified, the order of the devices, and - which one of them will own the link, is undefined. Claiming the same name for - a symlink, which is or might be used for a device node, may result in - unexpected behavior and is not supported. + devices claim the same name, the link always points to the device with + the highest link_priority. If the current device goes away, the links are + re-evaluated and the device with the next highest link_priority becomes the owner of + the link. If no link_priority is specified, the order of the devices (and + which one of them owns the link) is undefined. Also, symlink names must + never conflict with the kernel's default device node names, as that would + result in unpredictable behavior. @@ -359,7 +366,8 @@ Set a device property value. Property names with a leading '.' - are not stored in the database or exported to external tool or events. + are neither stored in the database nor exported to events or + external tools (run by, say, the PROGRAM match key). @@ -383,28 +391,27 @@ device. This can only be used for very short running tasks. Running an event process for a long period of time may block all further events for this or a dependent device. Long running tasks need to be immediately - detached from the event process itself. If the option - is - specified, and the executed program returns non-zero, the event will be - marked as failed for a possible later handling. + detached from the event process itself. If no absolute path is given, the program is expected to live in - /lib/udev, otherwise the absolute path must be - specified. Program name and arguments are separated by spaces. Single quotes - can be used to specify arguments with spaces. + the directory provided at compile-time to configure via --libexecdir + (this is usually /lib/udev), otherwise the absolute + path must be specified. The program name and following arguments are + separated by spaces. Single quotes can be used to specify arguments with + spaces. - Named label where a GOTO can jump to. + A named label to which a GOTO may jump. - Jumps to the next LABEL with a matching name + Jumps to the next LABEL with a matching name. @@ -426,8 +433,8 @@ - Import a text file specified as the assigned value, which must be in - environment key format. + Import a text file specified as the assigned value, the content + of which must be in environment key format. @@ -441,8 +448,8 @@ - Import a single property from the kernel commandline. For simple flags - the value of the property will be set to '1'. + Import a single property from the kernel command line. For simple flags + the value of the property is set to '1'. @@ -456,18 +463,15 @@ - If no option is given, udev will choose between - and based on the executable bit of the file - permissions. - Wait for a file to become available or until a 10 - seconds timeout expires. The path is relative to the sysfs device, - i. e. if no path is specified this waits for an attribute to appear. + Wait for a file to become available or until a timeout of + 10 seconds expires. The path is relative to the sysfs device; + if no path is specified, this waits for an attribute to appear. @@ -486,8 +490,8 @@ - Number of seconds an event will wait for operations to finish, before it - will terminate itself. + Number of seconds an event waits for operations to finish before + giving up and terminating itself. @@ -501,18 +505,18 @@ - Apply the permissions specified in this rule to a static device node with - the specified name. Static device nodes might be provided by kernel modules, + Apply the permissions specified in this rule to the static device node with + the specified name. Static device nodes might be provided by kernel modules or copied from /lib/udev/devices. These nodes might not have - a corresponding kernel device at the time udevd is started, and allow to trigger - automatic kernel module on-demand loading. + a corresponding kernel device at the time udevd is started; they can trigger + automatic kernel module loading. - Watch the device node with inotify, when closed after being opened for - writing, a change uevent will be synthesised. + Watch the device node with inotify; when the node is closed after being opened for + writing, a change uevent is synthesized. @@ -528,10 +532,10 @@ The , , , , , and - fields support simple printf-like string substitutions. The - format chars gets applied after all rules have been processed, right before the program - is executed. It allows the use of device properties set by earlier matching - rules. For all other fields, substitutions are applied while the individual rule is + fields support simple string substitutions. The + substitutions are performed after all rules have been processed, right before the program + is executed, allowing for the use of device properties set by earlier matching + rules. For all other fields, substitutions are performed while the individual rule is being processed. The available substitutions are: @@ -577,12 +581,12 @@ , - The value of a sysfs attribute found at the device, where + The value of a sysfs attribute found at the device where all keys of the rule have matched. If the matching device does not have such an attribute, and a previous KERNELS, SUBSYSTEMS, DRIVERS, or - ATTRS test selected a parent device, use the attribute from that - parent device. - If the attribute is a symlink, the last element of the symlink target is + ATTRS test selected a parent device, then the attribute from that + parent device is used. + If the attribute is a symlink, the last element of the symlink target is returned as the value. @@ -612,9 +616,9 @@ , The string returned by the external program requested with PROGRAM. - A single part of the string, separated by a space character may be selected + A single part of the string, separated by a space character, may be selected by specifying the part number as an attribute: . - If the number is followed by the '+' char this part plus all remaining parts + If the number is followed by the '+' character, this part plus all remaining parts of the result string are substituted: @@ -637,8 +641,8 @@ - The current list of symlinks, separated by a space character. The value is - only set if an earlier rule assigned a value, or during a remove events. + A space-separated list of the current symlinks. The value is + only set during a remove event or if an earlier rule assigned a value. @@ -659,7 +663,7 @@ , - The name of a created temporary device node to provide access to + The name of a temporary device node created to provide access to the device from a external program before the real node is created. diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 8b90829..130a71b 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -30,22 +30,25 @@ static void print_help(void) { printf("Usage: udevadm control COMMAND\n" + " --exit instruct the daemon to cleanup and exit\n" " --log-priority= set the udev log level for the daemon\n" " --stop-exec-queue keep udevd from executing events, queue only\n" " --start-exec-queue execute events, flush queue\n" " --reload-rules reloads the rules files\n" " --property== set a global property for all events\n" " --children-max= maximum number of children\n" + " --timeout= maximum time to block for a reply\n" " --help print this help text\n\n"); } -int udevadm_control(struct udev *udev, int argc, char *argv[]) +static int adm_control(struct udev *udev, int argc, char *argv[]) { struct udev_ctrl *uctrl = NULL; + int timeout = 60; int rc = 1; - /* compat values with '_' will be removed in a future release */ static const struct option options[] = { + { "exit", no_argument, NULL, 'e' }, { "log-priority", required_argument, NULL, 'l' }, { "stop-exec-queue", no_argument, NULL, 's' }, { "start-exec-queue", no_argument, NULL, 'S' }, @@ -53,6 +56,7 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) { "property", required_argument, NULL, 'p' }, { "env", required_argument, NULL, 'p' }, { "children-max", required_argument, NULL, 'm' }, + { "timeout", required_argument, NULL, 't' }, { "help", no_argument, NULL, 'h' }, {} }; @@ -62,45 +66,52 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) return 1; } - uctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); + uctrl = udev_ctrl_new(udev); if (uctrl == NULL) return 2; for (;;) { int option; - int i; - char *endp; - option = getopt_long(argc, argv, "l:sSRp:m:h", options, NULL); + option = getopt_long(argc, argv, "el:sSRp:m:h", options, NULL); if (option == -1) break; switch (option) { - case 'l': + case 'e': + if (udev_ctrl_send_exit(uctrl, timeout) < 0) + rc = 2; + else + rc = 0; + break; + case 'l': { + int i; + i = util_log_priority(optarg); if (i < 0) { fprintf(stderr, "invalid number '%s'\n", optarg); - goto exit; + goto out; } - if (udev_ctrl_send_set_log_level(uctrl, util_log_priority(optarg)) < 0) + if (udev_ctrl_send_set_log_level(uctrl, util_log_priority(optarg), timeout) < 0) rc = 2; else rc = 0; break; + } case 's': - if (udev_ctrl_send_stop_exec_queue(uctrl) < 0) + if (udev_ctrl_send_stop_exec_queue(uctrl, timeout) < 0) rc = 2; else rc = 0; break; case 'S': - if (udev_ctrl_send_start_exec_queue(uctrl) < 0) + if (udev_ctrl_send_start_exec_queue(uctrl, timeout) < 0) rc = 2; else rc = 0; break; case 'R': - if (udev_ctrl_send_reload_rules(uctrl) < 0) + if (udev_ctrl_send_reload_rules(uctrl, timeout) < 0) rc = 2; else rc = 0; @@ -108,24 +119,38 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) case 'p': if (strchr(optarg, '=') == NULL) { fprintf(stderr, "expect = instead of '%s'\n", optarg); - goto exit; + goto out; } - if (udev_ctrl_send_set_env(uctrl, optarg) < 0) + if (udev_ctrl_send_set_env(uctrl, optarg, timeout) < 0) rc = 2; else rc = 0; break; - case 'm': + case 'm': { + char *endp; + int i; + i = strtoul(optarg, &endp, 0); if (endp[0] != '\0' || i < 1) { fprintf(stderr, "invalid number '%s'\n", optarg); - goto exit; + goto out; } - if (udev_ctrl_send_set_children_max(uctrl, i) < 0) + if (udev_ctrl_send_set_children_max(uctrl, i, timeout) < 0) rc = 2; else rc = 0; break; + } + case 't': { + int seconds; + + seconds = atoi(optarg); + if (seconds >= 0) + timeout = seconds; + else + fprintf(stderr, "invalid timeout value\n"); + break; + } case 'h': print_help(); rc = 0; @@ -133,9 +158,17 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) } } - if (rc == 1) - err(udev, "unrecognized command\n"); -exit: + if (argv[optind] != NULL) + fprintf(stderr, "unknown option\n"); + else if (optind == 1) + fprintf(stderr, "missing option\n"); +out: udev_ctrl_unref(uctrl); return rc; } + +const struct udevadm_cmd udevadm_control = { + .name = "control", + .cmd = adm_control, + .help = "control the udev daemon", +}; diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 4510f4a..f7e7e86 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -31,49 +31,58 @@ #include "udev.h" -static void print_all_attributes(struct udev_device *device, const char *key) +static bool skip_attribute(const char *name) { - struct udev *udev = udev_device_get_udev(device); - DIR *dir; - struct dirent *dent; + static const char const *skip[] = { + "uevent", + "dev", + "modalias", + "resource", + "driver", + "subsystem", + "module", + }; + unsigned int i; - dir = opendir(udev_device_get_syspath(device)); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - struct stat statbuf; - const char *value; - size_t len; - - if (dent->d_name[0] == '.') - continue; - - if (strcmp(dent->d_name, "uevent") == 0) - continue; - if (strcmp(dent->d_name, "dev") == 0) - continue; - - if (fstatat(dirfd(dir), dent->d_name, &statbuf, AT_SYMLINK_NOFOLLOW) != 0) - continue; - if (S_ISLNK(statbuf.st_mode)) - continue; - - value = udev_device_get_sysattr_value(device, dent->d_name); - if (value == NULL) - continue; - dbg(udev, "attr '%s'='%s'\n", dent->d_name, value); - - /* skip nonprintable attributes */ - len = strlen(value); - while (len > 0 && isprint(value[len-1])) - len--; - if (len > 0) { - dbg(udev, "attribute value of '%s' non-printable, skip\n", dent->d_name); - continue; - } + for (i = 0; i < ARRAY_SIZE(skip); i++) + if (strcmp(name, skip[i]) == 0) + return true; + return false; +} - printf(" %s{%s}==\"%s\"\n", key, dent->d_name, value); +static void print_all_attributes(struct udev_device *device, const char *key) +{ + struct udev *udev = udev_device_get_udev(device); + struct udev_list_entry *sysattr; + + udev_list_entry_foreach(sysattr, udev_device_get_sysattr_list_entry(device)) { + const char *name; + const char *value; + size_t len; + + name = udev_list_entry_get_name(sysattr); + if (skip_attribute(name)) + continue; + + value = udev_device_get_sysattr_value(device, name); + if (value == NULL) + continue; + dbg(udev, "attr '%s'='%s'\n", name, value); + + /* skip any values that look like a path */ + if (value[0] == '/') + continue; + + /* skip nonprintable attributes */ + len = strlen(value); + while (len > 0 && isprint(value[len-1])) + len--; + if (len > 0) { + dbg(udev, "attribute value of '%s' non-printable, skip\n", name); + continue; } - closedir(dir); + + printf(" %s{%s}==\"%s\"\n", key, name, value); } printf("\n"); } @@ -195,67 +204,82 @@ static int export_devices(struct udev *udev) return 0; } -static int convert_db(struct udev *udev) +static void cleanup_dir(DIR *dir, mode_t mask, int depth) { - struct udev_enumerate *udev_enumerate; - struct udev_list_entry *list_entry; - - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_scan_devices(udev_enumerate); - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { - struct udev_device *device; + struct dirent *dent; - device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); - if (device != NULL) { - const char *id; - struct stat stats; - char to[UTIL_PATH_SIZE]; - char devpath[UTIL_PATH_SIZE]; - char from[UTIL_PATH_SIZE]; - - id = udev_device_get_id_filename(device); - if (id == NULL) { - udev_device_unref(device); - continue; - } - util_strscpyl(to, sizeof(to), udev_get_dev_path(udev), "/.udev/db/", id, NULL); - - /* find old database with $subsys:$sysname */ - util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), - "/.udev/db/", udev_device_get_subsystem(device), ":", - udev_device_get_sysname(device), NULL); - if (lstat(from, &stats) == 0) { - if (lstat(to, &stats) == 0) - unlink(from); - else - rename(from, to); + if (depth <= 0) + return; + + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + struct stat stats; + + if (dent->d_name[0] == '.') + continue; + if (fstatat(dirfd(dir), dent->d_name, &stats, AT_SYMLINK_NOFOLLOW) != 0) + continue; + if ((stats.st_mode & mask) != 0) + continue; + if (S_ISDIR(stats.st_mode)) { + DIR *dir2; + + dir2 = fdopendir(openat(dirfd(dir), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)); + if (dir2 != NULL) { + cleanup_dir(dir2, mask, depth-1); + closedir(dir2); } + unlinkat(dirfd(dir), dent->d_name, AT_REMOVEDIR); + } else { + unlinkat(dirfd(dir), dent->d_name, 0); + } + } +} - /* find old database with the encoded devpath */ - util_path_encode(udev_device_get_devpath(device), devpath, sizeof(devpath)); - util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), - "/.udev/db/", devpath, NULL); - if (lstat(from, &stats) == 0) { - if (lstat(to, &stats) == 0) - unlink(from); - else - rename(from, to); - } +static void cleanup_db(struct udev *udev) +{ + char filename[UTIL_PATH_SIZE]; + DIR *dir; - /* read the old database, and write out a new one */ - udev_device_read_db(device); - udev_device_update_db(device); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/queue.bin", NULL); + unlink(filename); - udev_device_unref(device); - } + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, S_ISVTX, 1); + closedir(dir); + } + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/links", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, 0, 2); + closedir(dir); + } + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/tags", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, 0, 2); + closedir(dir); + } + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/watch", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, 0, 1); + closedir(dir); + } + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/firmware-missing", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, 0, 1); + closedir(dir); } - udev_enumerate_unref(udev_enumerate); - return 0; } -int udevadm_info(struct udev *udev, int argc, char *argv[]) +static int uinfo(struct udev *udev, int argc, char *argv[]) { struct udev_device *device = NULL; bool root = 0; @@ -271,9 +295,10 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) { "path", required_argument, NULL, 'p' }, { "query", required_argument, NULL, 'q' }, { "attribute-walk", no_argument, NULL, 'a' }, + { "cleanup-db", no_argument, NULL, 'c' }, { "export-db", no_argument, NULL, 'e' }, - { "convert-db", no_argument, NULL, 'C' }, { "root", no_argument, NULL, 'r' }, + { "run", no_argument, NULL, 'R' }, { "device-id-of-file", required_argument, NULL, 'd' }, { "export", no_argument, NULL, 'x' }, { "export-prefix", required_argument, NULL, 'P' }, @@ -303,7 +328,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) int option; struct stat statbuf; - option = getopt_long(argc, argv, "aed:n:p:q:rxP:Vh", options, NULL); + option = getopt_long(argc, argv, "aced:n:p:q:rxP:RVh", options, NULL); if (option == -1) break; @@ -387,6 +412,9 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) action = ACTION_ROOT; root = true; break; + case 'R': + printf("%s\n", udev_get_run_path(udev)); + goto exit; case 'd': action = ACTION_DEVICE_ID_FILE; util_strscpy(name, sizeof(name), optarg); @@ -397,8 +425,8 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) case 'e': export_devices(udev); goto exit; - case 'C': - convert_db(udev); + case 'c': + cleanup_db(udev); goto exit; case 'x': export = true; @@ -426,10 +454,11 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) " --export export key/value pairs\n" " --export-prefix export the key name with a prefix\n" " --export-db export the content of the udev database\n" - " --convert-db convert older version of database without a reboot\n" + " --cleanup-db cleanup the udev database\n" " --help\n\n"); goto exit; default: + rc = 1; goto exit; } } @@ -531,3 +560,9 @@ exit: udev_device_unref(device); return rc; } + +const struct udevadm_cmd udevadm_info = { + .name = "info", + .cmd = uinfo, + .help = "query sysfs or the udev database", +}; diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 85252bb..64913db 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -24,32 +24,32 @@ #include #include #include +#include #include #include #include -#include +#include #include #include #include "udev.h" -static int udev_exit; +static bool udev_exit; static void sig_handler(int signum) { if (signum == SIGINT || signum == SIGTERM) - udev_exit = 1; + udev_exit = true; } static void print_device(struct udev_device *device, const char *source, int prop) { - struct timeval tv; - struct timezone tz; + struct timespec ts; - gettimeofday(&tv, &tz); + clock_gettime(CLOCK_MONOTONIC, &ts); printf("%-6s[%llu.%06u] %-8s %s (%s)\n", source, - (unsigned long long) tv.tv_sec, (unsigned int) tv.tv_usec, + (unsigned long long) ts.tv_sec, (unsigned int) ts.tv_nsec/1000, udev_device_get_action(device), udev_device_get_devpath(device), udev_device_get_subsystem(device)); @@ -64,19 +64,21 @@ static void print_device(struct udev_device *device, const char *source, int pro } } -int udevadm_monitor(struct udev *udev, int argc, char *argv[]) +static int adm_monitor(struct udev *udev, int argc, char *argv[]) { struct sigaction act; sigset_t mask; int option; - int prop = 0; - int print_kernel = 0; - int print_udev = 0; - struct udev_list_node subsystem_match_list; - struct udev_list_node tag_match_list; + bool prop = false; + bool print_kernel = false; + bool print_udev = false; + struct udev_list subsystem_match_list; + struct udev_list tag_match_list; struct udev_monitor *udev_monitor = NULL; struct udev_monitor *kernel_monitor = NULL; - fd_set readfds; + int fd_ep = -1; + int fd_kernel = -1, fd_udev = -1; + struct epoll_event ep_kernel, ep_udev; int rc = 0; static const struct option options[] = { @@ -90,8 +92,9 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) {} }; - udev_list_init(&subsystem_match_list); - udev_list_init(&tag_match_list); + udev_list_init(udev, &subsystem_match_list, true); + udev_list_init(udev, &tag_match_list, true); + for (;;) { option = getopt_long(argc, argv, "pekus:t:h", options, NULL); if (option == -1) @@ -100,13 +103,13 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) switch (option) { case 'p': case 'e': - prop = 1; + prop = true; break; case 'k': - print_kernel = 1; + print_kernel = true; break; case 'u': - print_udev = 1; + print_udev = true; break; case 's': { @@ -119,11 +122,11 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) devtype[0] = '\0'; devtype++; } - udev_list_entry_add(udev, &subsystem_match_list, subsys, devtype, 0, 0); + udev_list_entry_add(&subsystem_match_list, subsys, devtype); break; } case 't': - udev_list_entry_add(udev, &tag_match_list, optarg, NULL, 0, 0); + udev_list_entry_add(&tag_match_list, optarg, NULL); break; case 'h': printf("Usage: udevadm monitor [--property] [--kernel] [--udev] [--help]\n" @@ -133,14 +136,16 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) " --subsystem-match= filter events by subsystem\n" " --tag-match= filter events by tag\n" " --help\n\n"); + goto out; default: + rc = 1; goto out; } } if (!print_kernel && !print_udev) { - print_kernel = 1; - print_udev =1; + print_kernel = true; + print_udev = true; } /* set signal handlers */ @@ -155,6 +160,12 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) sigaddset(&mask, SIGTERM); sigprocmask(SIG_UNBLOCK, &mask, NULL); + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + err(udev, "error creating epoll fd: %m\n"); + goto out; + } + printf("monitor will print the received events for:\n"); if (print_udev) { struct udev_list_entry *entry; @@ -166,6 +177,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) goto out; } udev_monitor_set_receive_buffer_size(udev_monitor, 128*1024*1024); + fd_udev = udev_monitor_get_fd(udev_monitor); udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) { const char *subsys = udev_list_entry_get_name(entry); @@ -187,8 +199,18 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) rc = 2; goto out; } + + memset(&ep_udev, 0, sizeof(struct epoll_event)); + ep_udev.events = EPOLLIN; + ep_udev.data.fd = fd_udev; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_udev, &ep_udev) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + printf("UDEV - the event which udev sends out after rule processing\n"); } + if (print_kernel) { struct udev_list_entry *entry; @@ -199,6 +221,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) goto out; } udev_monitor_set_receive_buffer_size(kernel_monitor, 128*1024*1024); + fd_kernel = udev_monitor_get_fd(kernel_monitor); udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) { const char *subsys = udev_list_entry_get_name(entry); @@ -212,52 +235,63 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) rc = 4; goto out; } + + memset(&ep_kernel, 0, sizeof(struct epoll_event)); + ep_kernel.events = EPOLLIN; + ep_kernel.data.fd = fd_kernel; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_kernel, &ep_kernel) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + printf("KERNEL - the kernel uevent\n"); } printf("\n"); while (!udev_exit) { int fdcount; + struct epoll_event ev[4]; + int i; - FD_ZERO(&readfds); - if (kernel_monitor != NULL) - FD_SET(udev_monitor_get_fd(kernel_monitor), &readfds); - if (udev_monitor != NULL) - FD_SET(udev_monitor_get_fd(udev_monitor), &readfds); - - fdcount = select(MAX(udev_monitor_get_fd(kernel_monitor), udev_monitor_get_fd(udev_monitor))+1, - &readfds, NULL, NULL, NULL); + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); if (fdcount < 0) { if (errno != EINTR) fprintf(stderr, "error receiving uevent message: %m\n"); continue; } - if ((kernel_monitor != NULL) && FD_ISSET(udev_monitor_get_fd(kernel_monitor), &readfds)) { - struct udev_device *device; - - device = udev_monitor_receive_device(kernel_monitor); - if (device == NULL) - continue; - print_device(device, "KERNEL", prop); - udev_device_unref(device); - } - - if ((udev_monitor != NULL) && FD_ISSET(udev_monitor_get_fd(udev_monitor), &readfds)) { - struct udev_device *device; - - device = udev_monitor_receive_device(udev_monitor); - if (device == NULL) - continue; - print_device(device, "UDEV", prop); - udev_device_unref(device); + for (i = 0; i < fdcount; i++) { + if (ev[i].data.fd == fd_kernel && ev[i].events & EPOLLIN) { + struct udev_device *device; + + device = udev_monitor_receive_device(kernel_monitor); + if (device == NULL) + continue; + print_device(device, "KERNEL", prop); + udev_device_unref(device); + } else if (ev[i].data.fd == fd_udev && ev[i].events & EPOLLIN) { + struct udev_device *device; + + device = udev_monitor_receive_device(udev_monitor); + if (device == NULL) + continue; + print_device(device, "UDEV", prop); + udev_device_unref(device); + } } } - out: + if (fd_ep >= 0) + close(fd_ep); udev_monitor_unref(udev_monitor); udev_monitor_unref(kernel_monitor); - udev_list_cleanup_entries(udev, &subsystem_match_list); - udev_list_cleanup_entries(udev, &tag_match_list); + udev_list_cleanup(&subsystem_match_list); + udev_list_cleanup(&tag_match_list); return rc; } + +const struct udevadm_cmd udevadm_monitor = { + .name = "monitor", + .cmd = adm_monitor, + .help = "listen to kernel and udev events", +}; diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 1423cec..a59d7c3 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -29,27 +29,14 @@ #include #include #include +#include +#include #include #include #include "udev.h" -#define DEFAULT_TIMEOUT 180 -#define LOOP_PER_SECOND 20 - -static volatile sig_atomic_t is_timeout; - -static void sig_handler(int signum) -{ - switch (signum) { - case SIGALRM: - is_timeout = 1; - case SIGUSR1: - ; - } -} - -int udevadm_settle(struct udev *udev, int argc, char *argv[]) +static int adm_settle(struct udev *udev, int argc, char *argv[]) { static const struct option options[] = { { "seq-start", required_argument, NULL, 's' }, @@ -60,30 +47,18 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) { "help", no_argument, NULL, 'h' }, {} }; + unsigned long long start_usec = now_usec(); unsigned long long start = 0; unsigned long long end = 0; int quiet = 0; const char *exists = NULL; - int timeout = DEFAULT_TIMEOUT; - struct sigaction act; - sigset_t mask; + unsigned int timeout = 120; + struct pollfd pfd[1]; struct udev_queue *udev_queue = NULL; - int rc = 1; + int rc = EXIT_FAILURE; dbg(udev, "version %s\n", VERSION); - /* set signal handlers */ - memset(&act, 0x00, sizeof(act)); - act.sa_handler = sig_handler; - sigemptyset (&act.sa_mask); - act.sa_flags = 0; - sigaction(SIGALRM, &act, NULL); - sigaction(SIGUSR1, &act, NULL); - sigemptyset(&mask); - sigaddset(&mask, SIGUSR1); - sigaddset(&mask, SIGALRM); - sigprocmask(SIG_UNBLOCK, &mask, NULL); - for (;;) { int option; int seconds; @@ -121,15 +96,12 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) " --exit-if-exists= stop waiting if file exists\n" " --quiet do not print list after timeout\n" " --help\n\n"); - exit(0); + exit(EXIT_SUCCESS); + default: + exit(EXIT_FAILURE); } } - if (timeout > 0) - alarm(timeout); - else - is_timeout = 1; - udev_queue = udev_queue_new(udev); if (udev_queue == NULL) exit(2); @@ -166,64 +138,98 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) if (getuid() == 0) { struct udev_ctrl *uctrl; - uctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); + uctrl = udev_ctrl_new(udev); if (uctrl != NULL) { - sigset_t oldmask; - - sigemptyset(&mask); - sigaddset(&mask, SIGUSR1); - sigaddset(&mask, SIGALRM); - sigprocmask(SIG_BLOCK, &mask, &oldmask); - if (udev_ctrl_send_settle(uctrl) > 0) - sigsuspend(&oldmask); - sigprocmask(SIG_SETMASK, &oldmask, NULL); + if (udev_ctrl_send_ping(uctrl, timeout) < 0) { + info(udev, "no connection to daemon\n"); + udev_ctrl_unref(uctrl); + rc = EXIT_SUCCESS; + goto out; + } udev_ctrl_unref(uctrl); } } + pfd[0].events = POLLIN; + pfd[0].fd = inotify_init1(IN_CLOEXEC); + if (pfd[0].fd < 0) { + err(udev, "inotify_init failed: %m\n"); + } else { + if (inotify_add_watch(pfd[0].fd, udev_get_run_path(udev), IN_MOVED_TO) < 0) { + err(udev, "watching '%s' failed\n", udev_get_run_path(udev)); + close(pfd[0].fd); + pfd[0].fd = -1; + } + } + for (;;) { struct stat statbuf; - const struct timespec duration = { 0 , 1000 * 1000 * 1000 / LOOP_PER_SECOND }; if (exists != NULL && stat(exists, &statbuf) == 0) { - rc = 0; + rc = EXIT_SUCCESS; break; } if (start > 0) { /* if asked for, wait for a specific sequence of events */ if (udev_queue_get_seqnum_sequence_is_finished(udev_queue, start, end) == 1) { - rc = 0; + rc = EXIT_SUCCESS; break; } } else { /* exit if queue is empty */ if (udev_queue_get_queue_is_empty(udev_queue)) { - rc = 0; + rc = EXIT_SUCCESS; break; } } - if (is_timeout) - break; + if (pfd[0].fd >= 0) { + int delay; - nanosleep(&duration, NULL); - } + if (exists != NULL || start > 0) + delay = 100; + else + delay = 1000; + /* wake up after delay, or immediately after the queue is rebuilt */ + if (poll(pfd, 1, delay) > 0 && pfd[0].revents & POLLIN) { + char buf[sizeof(struct inotify_event) + PATH_MAX]; - /* if we reached the timeout, print the list of remaining events */ - if (is_timeout) { - struct udev_list_entry *list_entry; - - if (!quiet && udev_queue_get_queued_list_entry(udev_queue) != NULL) { - info(udev, "timeout waiting for udev queue\n"); - printf("\nudevadm settle - timeout of %i seconds reached, the event queue contains:\n", timeout); - udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) - printf(" %s (%s)\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); + read(pfd[0].fd, buf, sizeof(buf)); + } + } else { + sleep(1); } - } + if (timeout > 0) { + unsigned long long age_usec; + + age_usec = now_usec() - start_usec; + if (age_usec / (1000 * 1000) >= timeout) { + struct udev_list_entry *list_entry; + + if (!quiet && udev_queue_get_queued_list_entry(udev_queue) != NULL) { + info(udev, "timeout waiting for udev queue\n"); + printf("\nudevadm settle - timeout of %i seconds reached, the event queue contains:\n", timeout); + udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) + printf(" %s (%s)\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + } + + break; + } + } + } +out: + if (pfd[0].fd >= 0) + close(pfd[0].fd); udev_queue_unref(udev_queue); return rc; } + +const struct udevadm_cmd udevadm_settle = { + .name = "settle", + .cmd = adm_settle, + .help = "wait for the event queue to finish", +}; diff --git a/udev/udevadm-test-builtin.c b/udev/udevadm-test-builtin.c new file mode 100644 index 0000000..a2be776 --- /dev/null +++ b/udev/udevadm-test-builtin.c @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2011 Kay Sievers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static void help(struct udev *udev) +{ + fprintf(stderr, "\n"); + fprintf(stderr, "Usage: udevadm builtin [--help] \n"); + udev_builtin_list(udev); + fprintf(stderr, "\n"); +} + +static int adm_builtin(struct udev *udev, int argc, char *argv[]) +{ + static const struct option options[] = { + { "help", no_argument, NULL, 'h' }, + {} + }; + char *command = NULL; + char *syspath = NULL; + char filename[UTIL_PATH_SIZE]; + struct udev_device *dev = NULL; + enum udev_builtin_cmd cmd; + int rc = EXIT_SUCCESS; + + dbg(udev, "version %s\n", VERSION); + + for (;;) { + int option; + + option = getopt_long(argc, argv, "h", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'h': + help(udev); + goto out; + } + } + command = argv[optind++]; + if (command == NULL) { + fprintf(stderr, "command missing\n"); + help(udev); + rc = 2; + goto out; + } + + syspath = argv[optind++]; + if (syspath == NULL) { + fprintf(stderr, "syspath missing\n\n"); + rc = 3; + goto out; + } + + /* add /sys if needed */ + if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) + util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), syspath, NULL); + else + util_strscpy(filename, sizeof(filename), syspath); + util_remove_trailing_chars(filename, '/'); + + dev = udev_device_new_from_syspath(udev, filename); + if (dev == NULL) { + fprintf(stderr, "unable to open device '%s'\n\n", filename); + rc = 4; + goto out; + } + + cmd = udev_builtin_lookup(command); + if (cmd >= UDEV_BUILTIN_MAX) { + fprintf(stderr, "unknown command '%s'\n", command); + help(udev); + rc = 5; + goto out; + } + + if (udev_builtin_run(dev, cmd, true) < 0) { + fprintf(stderr, "error executing '%s'\n\n", command); + rc = 6; + } +out: + udev_device_unref(dev); + return rc; +} + +const struct udevadm_cmd udevadm_test_builtin = { + .name = "test-builtin", + .cmd = adm_builtin, + .help = "test a built-in command", +}; diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 4db70c4..e807fc0 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -27,23 +27,27 @@ #include #include #include +#include #include "udev.h" -int udevadm_test(struct udev *udev, int argc, char *argv[]) +static int adm_test(struct udev *udev, int argc, char *argv[]) { + int resolve_names = 1; char filename[UTIL_PATH_SIZE]; const char *action = "add"; const char *syspath = NULL; - struct udev_event *event; - struct udev_device *dev; + struct udev_event *event = NULL; + struct udev_device *dev = NULL; struct udev_rules *rules = NULL; struct udev_list_entry *entry; + sigset_t mask, sigmask_orig; int err; int rc = 0; static const struct option options[] = { { "action", required_argument, NULL, 'a' }, + { "resolve-names", required_argument, NULL, 'N' }, { "help", no_argument, NULL, 'h' }, {} }; @@ -53,7 +57,7 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) for (;;) { int option; - option = getopt_long(argc, argv, "a:s:fh", options, NULL); + option = getopt_long(argc, argv, "a:s:N:fh", options, NULL); if (option == -1) break; @@ -62,21 +66,34 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) case 'a': action = optarg; break; + case 'N': + if (strcmp (optarg, "early") == 0) { + resolve_names = 1; + } else if (strcmp (optarg, "late") == 0) { + resolve_names = 0; + } else if (strcmp (optarg, "never") == 0) { + resolve_names = -1; + } else { + fprintf(stderr, "resolve-names must be early, late or never\n"); + err(udev, "resolve-names must be early, late or never\n"); + exit(EXIT_FAILURE); + } + break; case 'h': printf("Usage: udevadm test OPTIONS \n" " --action= set action string\n" " --help\n\n"); - exit(0); + exit(EXIT_SUCCESS); default: - exit(1); + exit(EXIT_FAILURE); } } syspath = argv[optind]; if (syspath == NULL) { fprintf(stderr, "syspath parameter missing\n"); - rc = 1; - goto exit; + rc = 2; + goto out; } printf("This program is for debugging only, it does not run any program,\n" @@ -84,11 +101,13 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) "some values may be different, or not available at a simulation run.\n" "\n"); - rules = udev_rules_new(udev, 1); + sigprocmask(SIG_SETMASK, NULL, &sigmask_orig); + + rules = udev_rules_new(udev, resolve_names); if (rules == NULL) { fprintf(stderr, "error reading rules\n"); - rc = 1; - goto exit; + rc = 3; + goto out; } /* add /sys if needed */ @@ -101,8 +120,8 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) dev = udev_device_new_from_syspath(udev, filename); if (dev == NULL) { fprintf(stderr, "unable to open device '%s'\n", filename); - rc = 2; - goto exit; + rc = 4; + goto out; } /* skip reading of db, but read kernel parameters */ @@ -111,24 +130,41 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) udev_device_set_action(dev, action); event = udev_event_new(dev); - err = udev_event_execute_rules(event, rules); - if (udev_device_get_event_timeout(dev) >= 0) - info(udev, "custom event timeout: %i\n", udev_device_get_event_timeout(dev)); + sigfillset(&mask); + sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); + event->fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); + if (event->fd_signal < 0) { + fprintf(stderr, "error creating signalfd\n"); + rc = 5; + goto out; + } + + err = udev_event_execute_rules(event, rules, &sigmask_orig); udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) - info(udev, "%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); + printf("%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); - if (err == 0) + if (err == 0) { udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { char program[UTIL_PATH_SIZE]; udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program)); - info(udev, "run: '%s'\n", program); + printf("run: '%s'\n", program); } + } +out: + if (event != NULL && event->fd_signal >= 0) + close(event->fd_signal); udev_event_unref(event); udev_device_unref(dev); -exit: udev_rules_unref(rules); return rc; } + +const struct udevadm_cmd udevadm_test = { + .name = "test", + .cmd = adm_test, + .help = "test an event run", + .debug = true, +}; diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index c32e0b4..2cee229 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -61,20 +61,6 @@ static void exec_list(struct udev_enumerate *udev_enumerate, const char *action) } } -static int scan_failed(struct udev_enumerate *udev_enumerate) -{ - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - struct udev_queue *udev_queue; - struct udev_list_entry *list_entry; - - udev_queue = udev_queue_new(udev); - if (udev_queue == NULL) - return -1; - udev_list_entry_foreach(list_entry, udev_queue_get_failed_list_entry(udev_queue)) - udev_enumerate_add_syspath(udev_enumerate, udev_list_entry_get_name(list_entry)); - return 0; -} - static const char *keyval(const char *str, const char **val, char *buf, size_t size) { char *pos; @@ -89,7 +75,7 @@ static const char *keyval(const char *str, const char **val, char *buf, size_t s return buf; } -int udevadm_trigger(struct udev *udev, int argc, char *argv[]) +static int adm_trigger(struct udev *udev, int argc, char *argv[]) { static const struct option options[] = { { "verbose", no_argument, NULL, 'v' }, @@ -103,13 +89,13 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) { "property-match", required_argument, NULL, 'p' }, { "tag-match", required_argument, NULL, 'g' }, { "sysname-match", required_argument, NULL, 'y' }, + { "parent-match", required_argument, NULL, 'b' }, { "help", no_argument, NULL, 'h' }, {} }; enum { TYPE_DEVICES, TYPE_SUBSYSTEMS, - TYPE_FAILED, } device_type = TYPE_DEVICES; const char *action = "change"; struct udev_enumerate *udev_enumerate; @@ -128,7 +114,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) const char *val; char buf[UTIL_PATH_SIZE]; - option = getopt_long(argc, argv, "vng:o:t:hc:p:s:S:a:A:y:", options, NULL); + option = getopt_long(argc, argv, "vng:o:t:hc:p:s:S:a:A:y:b:", options, NULL); if (option == -1) break; @@ -144,8 +130,6 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) device_type = TYPE_DEVICES; } else if (strcmp(optarg, "subsystems") == 0) { device_type = TYPE_SUBSYSTEMS; - } else if (strcmp(optarg, "failed") == 0) { - device_type = TYPE_FAILED; } else { err(udev, "unknown type --type=%s\n", optarg); rc = 2; @@ -179,6 +163,27 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) case 'y': udev_enumerate_add_match_sysname(udev_enumerate, optarg); break; + case 'b': { + char path[UTIL_PATH_SIZE]; + struct udev_device *dev; + + /* add sys dir if needed */ + if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) + util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), optarg, NULL); + else + util_strscpy(path, sizeof(path), optarg); + util_remove_trailing_chars(path, '/'); + dev = udev_device_new_from_syspath(udev, path); + if (dev == NULL) { + err(udev, "unable to open the device '%s'\n", optarg); + rc = 2; + goto exit; + } + udev_enumerate_add_match_parent(udev_enumerate, dev); + /* drop reference immediately, enumerate pins the device as long as needed */ + udev_device_unref(dev); + break; + } case 'h': printf("Usage: udevadm trigger OPTIONS\n" " --verbose print the list of devices while running\n" @@ -186,8 +191,6 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) " --type= type of events to trigger\n" " devices sys devices (default)\n" " subsystems sys subsystems and drivers\n" - " failed trigger only the events which have been\n" - " marked as failed during a previous run\n" " --action= event action value, default is \"change\"\n" " --subsystem-match= trigger devices from a matching subsystem\n" " --subsystem-nomatch= exclude devices from a matching subsystem\n" @@ -196,18 +199,16 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) " --property-match== trigger devices with a matching property\n" " --tag-match== trigger devices with a matching property\n" " --sysname-match= trigger devices with a matching name\n" + " --parent-match= trigger devices with that parent device\n" " --help\n\n"); goto exit; default: + rc = 1; goto exit; } } switch (device_type) { - case TYPE_FAILED: - scan_failed(udev_enumerate); - exec_list(udev_enumerate, action); - goto exit; case TYPE_SUBSYSTEMS: udev_enumerate_scan_subsystems(udev_enumerate); exec_list(udev_enumerate, action); @@ -223,3 +224,9 @@ exit: udev_enumerate_unref(udev_enumerate); return rc; } + +const struct udevadm_cmd udevadm_trigger = { + .name = "trigger", + .cmd = adm_trigger, + .help = "request events from the kernel", +}; diff --git a/udev/udevadm.8 b/udev/udevadm.8 index e6cc083..05fd273 100644 --- a/udev/udevadm.8 +++ b/udev/udevadm.8 @@ -1,13 +1,22 @@ '\" t .\" Title: udevadm .\" Author: [see the "Author" section] -.\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 02/10/2011 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 10/19/2011 .\" Manual: udevadm .\" Source: udev .\" Language: English .\" -.TH "UDEVADM" "8" "02/10/2011" "udev" "udevadm" +.TH "UDEVADM" "8" "10/19/2011" "udev" "udevadm" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -35,6 +44,8 @@ udevadm \- udev management tool \fBudevadm monitor \fR\fB[options]\fR .HP \w'\fBudevadm\ test\ \fR\fB[options]\fR\fB\ \fR\fB\fIdevpath\fR\fR\ 'u \fBudevadm test \fR\fB[options]\fR\fB \fR\fB\fIdevpath\fR\fR +.HP \w'\fBudevadm\ test\-builtin\ \fR\fB[options]\fR\fB\ \fR\fB\fIcommand\fR\fR\fB\ \fR\fB\fIdevpath\fR\fR\ 'u +\fBudevadm test\-builtin \fR\fB[options]\fR\fB \fR\fB\fIcommand\fR\fR\fB \fR\fB\fIdevpath\fR\fR .SH "DESCRIPTION" .PP udevadm expects a command and command specific options\&. It controls the runtime behavior of udev, requests kernel events, manages the event queue, and provides simple debugging mechanisms\&. @@ -92,6 +103,12 @@ or query, the query returns the absolute path including the root directory\&. .RE .PP +\fB\-\-run\fR +.RS 4 +The udev runtime directory: +/run/udev\&. +.RE +.PP \fB\-\-attribute\-walk\fR .RS 4 Print all sysfs properties of the specified device that can be used in udev rules to match the specified device\&. It prints all devices along the chain, up to the root of sysfs that can be used in udev rules\&. @@ -117,9 +134,9 @@ Print major/minor numbers of the underlying device, where the file lives on\&. Export the content of the udev database\&. .RE .PP -\fB\-\-convert\-db\fR +\fB\-\-cleanup\-db\fR .RS 4 -Convert the database of an earlier udev version to the current format\&. This is only useful on udev version upgrades, where the content of the old database might be needed for the running system, and it is not sufficient for it, to be re\-created with the next bootup\&. +Cleanup the udev database\&. .RE .PP \fB\-\-version\fR @@ -149,8 +166,7 @@ Do not actually trigger the event\&. .RS 4 Trigger a specific type of devices\&. Valid types are: \fBdevices\fR, -\fBsubsystems\fR, -\fBfailed\fR\&. The default value is +\fBsubsystems\fR\&. The default value is \fBdevices\fR\&. .RE .PP @@ -194,13 +210,18 @@ Trigger events for devices with a matching tag\&. This option can be specified m .RS 4 Trigger events for devices with a matching sys device name\&. This option can be specified multiple times and supports shell style pattern matching\&. .RE +.PP +\fB\-\-parent\-match=\fR\fB\fIsyspath\fR\fR +.RS 4 +Trigger events for all children of a given device\&. +.RE .SS "udevadm settle [options]" .PP Watches the udev event queue, and exits if all current events are handled\&. .PP \fB\-\-timeout=\fR\fB\fIseconds\fR\fR .RS 4 -Maximum number of seconds to wait for the event queue to become empty\&. The default value is 180 seconds\&. A value of 0 will check if the queue is empty and always return immediately\&. +Maximum number of seconds to wait for the event queue to become empty\&. The default value is 120 seconds\&. A value of 0 will check if the queue is empty and always return immediately\&. .RE .PP \fB\-\-seq\-start=\fR\fB\fIseqnum\fR\fR @@ -231,6 +252,11 @@ Print help text\&. .PP Modify the internal state of the running udev daemon\&. .PP +\fB\-\-exit\fR +.RS 4 +Signal and wait for udevd to exit\&. +.RE +.PP \fB\-\-log\-priority=\fR\fB\fIvalue\fR\fR .RS 4 Set the internal log level of udevd\&. Valid values are the numerical syslog priorities or their textual representations: @@ -265,6 +291,11 @@ Set a global property for all events\&. Set the maximum number of events, udevd will handle at the same time\&. .RE .PP +\fB\-\-timeout=\fR\fIseconds\fR +.RS 4 +The maximum number seonds to wait for a reply from udevd\&. +.RE +.PP \fB\-\-help\fR .RS 4 Print help text\&. @@ -320,6 +351,14 @@ The subsystem string\&. .RS 4 Print help text\&. .RE +.SS "udevadm test\-builtin [options] \fIcommand\fR \fIdevpath\fR" +.PP +Run a built\-in command for the given device, and print debug output\&. +.PP +\fB\-\-help\fR +.RS 4 +Print help text\&. +.RE .SH "AUTHOR" .PP Written by Kay Sievers diff --git a/udev/udevadm.c b/udev/udevadm.c index 19b89ad..178981e 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -25,7 +25,7 @@ #include "udev.h" -static int debug; +static bool debug; static void log_fn(struct udev *udev, int priority, const char *file, int line, const char *fn, @@ -44,80 +44,50 @@ static void log_fn(struct udev *udev, int priority, } } -struct command { - const char *name; - int (*cmd)(struct udev *udev, int argc, char *argv[]); - const char *help; - int debug; -}; - -static const struct command cmds[]; - -static int version(struct udev *udev, int argc, char *argv[]) +static int adm_version(struct udev *udev, int argc, char *argv[]) { printf("%s\n", VERSION); return 0; } +static const struct udevadm_cmd udevadm_version = { + .name = "version", + .cmd = adm_version, +}; + +static int adm_help(struct udev *udev, int argc, char *argv[]); +static const struct udevadm_cmd udevadm_help = { + .name = "help", + .cmd = adm_help, +}; -static int help(struct udev *udev, int argc, char *argv[]) +static const struct udevadm_cmd *udevadm_cmds[] = { + &udevadm_info, + &udevadm_trigger, + &udevadm_settle, + &udevadm_control, + &udevadm_monitor, + &udevadm_test, + &udevadm_test_builtin, + &udevadm_version, + &udevadm_help, +}; + +static int adm_help(struct udev *udev, int argc, char *argv[]) { - const struct command *cmd; + unsigned int i; - printf("Usage: udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n"); - for (cmd = cmds; cmd->name != NULL; cmd++) - if (cmd->help != NULL) - printf(" %-12s %s\n", cmd->name, cmd->help); - printf("\n"); + fprintf(stderr, "Usage: udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n"); + for (i = 0; i < ARRAY_SIZE(udevadm_cmds); i++) + if (udevadm_cmds[i]->help != NULL) + printf(" %-12s %s\n", udevadm_cmds[i]->name, udevadm_cmds[i]->help); + fprintf(stderr, "\n"); return 0; } -static const struct command cmds[] = { - { - .name = "info", - .cmd = udevadm_info, - .help = "query sysfs or the udev database", - }, - { - .name = "trigger", - .cmd = udevadm_trigger, - .help = "request events from the kernel", - }, - { - .name = "settle", - .cmd = udevadm_settle, - .help = "wait for the event queue to finish", - }, - { - .name = "control", - .cmd = udevadm_control, - .help = "control the udev daemon", - }, - { - .name = "monitor", - .cmd = udevadm_monitor, - .help = "listen to kernel and udev events", - }, - { - .name = "test", - .cmd = udevadm_test, - .help = "simulation run", - .debug = 1, - }, - { - .name = "version", - .cmd = version, - }, - { - .name = "help", - .cmd = help, - }, - {} -}; - -static int run_command(struct udev *udev, const struct command *cmd, int argc, char *argv[]) +static int run_command(struct udev *udev, const struct udevadm_cmd *cmd, int argc, char *argv[]) { if (cmd->debug) { - debug = 1; + debug = true; if (udev_get_log_priority(udev) < LOG_INFO) udev_set_log_priority(udev, LOG_INFO); } @@ -135,7 +105,7 @@ int main(int argc, char *argv[]) {} }; const char *command; - int i; + unsigned int i; int rc = 1; udev = udev_new(); @@ -155,15 +125,15 @@ int main(int argc, char *argv[]) switch (option) { case 'd': - debug = 1; + debug = true; if (udev_get_log_priority(udev) < LOG_INFO) udev_set_log_priority(udev, LOG_INFO); break; case 'h': - rc = help(udev, argc, argv); + rc = adm_help(udev, argc, argv); goto out; case 'V': - rc = version(udev, argc, argv); + rc = adm_version(udev, argc, argv); goto out; default: goto out; @@ -171,19 +141,21 @@ int main(int argc, char *argv[]) } command = argv[optind]; + info(udev, "runtime dir '%s'\n", udev_get_run_path(udev)); + if (command != NULL) - for (i = 0; cmds[i].cmd != NULL; i++) { - if (strcmp(cmds[i].name, command) == 0) { + for (i = 0; i < ARRAY_SIZE(udevadm_cmds); i++) { + if (strcmp(udevadm_cmds[i]->name, command) == 0) { argc -= optind; argv += optind; optind = 0; - rc = run_command(udev, &cmds[i], argc, argv); + rc = run_command(udev, udevadm_cmds[i], argc, argv); goto out; } } fprintf(stderr, "missing or unknown command\n\n"); - help(udev, argc, argv); + adm_help(udev, argc, argv); rc = 2; out: udev_selinux_exit(udev); diff --git a/udev/udevadm.html b/udev/udevadm.html index 80fd51d..fc88574 100644 --- a/udev/udevadm.html +++ b/udev/udevadm.html @@ -1,8 +1,8 @@ -udevadm

Name

udevadm — udev management tool

Synopsis

udevadm [--debug] [--version] [--help]

udevadm info options

udevadm trigger [options]

udevadm settle [options]

udevadm control command

udevadm monitor [options]

udevadm test [options] devpath

Description

udevadm expects a command and command specific options. It +udevadm

Name

udevadm — udev management tool

Synopsis

udevadm [--debug] [--version] [--help]

udevadm info options

udevadm trigger [options]

udevadm settle [options]

udevadm control command

udevadm monitor [options]

udevadm test [options] devpath

udevadm test-builtin [options] command devpath

OPTIONS

--debug

Print debug messages to stderr.

--version

Print version number.

--help

Print help text.

OPTIONS

--debug

Print debug messages to stderr.

--version

Print version number.

--help

Print help text.

udevadm info options

Queries the udev database for device information stored in the udev database. It can also query the properties of a device from its sysfs representation to help creating udev rules that match this device.

--query=type

Query the database for specified type of device data. It needs the @@ -11,14 +11,11 @@ name, symlink, path, property, all.

--path=devpath

The devpath of the device to query.

--name=file

The name of the device node or a symlink to query

--root

The udev root directory: /dev. If used in conjunction with a name or symlink query, the - query returns the absolute path including the root directory.

--attribute-walk

Print all sysfs properties of the specified device that can be used + query returns the absolute path including the root directory.

--run

The udev runtime directory: /run/udev.

--attribute-walk

Print all sysfs properties of the specified device that can be used in udev rules to match the specified device. It prints all devices along the chain, up to the root of sysfs that can be used in udev rules.

--export

Print output as key/value pairs. Values are enclosed in single quotes.

--export-prefix=name

Add a prefix to the key name of exported values.

--device-id-of-file=file

Print major/minor numbers of the underlying device, where the file - lives on.

--export-db

Export the content of the udev database.

--convert-db

Convert the database of an earlier udev version to the current format. This - is only useful on udev version upgrades, where the content of the old database might - be needed for the running system, and it is not sufficient for it, to be re-created - with the next bootup.

--version

Print version.

--help

Print help text.

diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 00f299f..2fdbb42 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -44,6 +44,9 @@ udevadm test options devpath + + udevadm test-builtin options command devpath + Description @@ -111,6 +114,12 @@ + + + The udev runtime directory: /run/udev. + + + Print all sysfs properties of the specified device that can be used @@ -144,12 +153,9 @@ - + - Convert the database of an earlier udev version to the current format. This - is only useful on udev version upgrades, where the content of the old database might - be needed for the running system, and it is not sufficient for it, to be re-created - with the next bootup. + Cleanup the udev database. @@ -186,7 +192,7 @@ Trigger a specific type of devices. Valid types are: - devices, subsystems, failed. + devices, subsystems. The default value is devices. @@ -249,6 +255,12 @@ specified multiple times and supports shell style pattern matching. + + + + Trigger events for all children of a given device. + + @@ -259,7 +271,7 @@ Maximum number of seconds to wait for the event queue to become empty. - The default value is 180 seconds. A value of 0 will check if the queue is empty + The default value is 120 seconds. A value of 0 will check if the queue is empty and always return immediately. @@ -300,6 +312,12 @@ Modify the internal state of the running udev daemon. + + + Signal and wait for udevd to exit. + + + Set the internal log level of udevd. Valid values are the numerical @@ -343,6 +361,12 @@ + seconds + + The maximum number seonds to wait for a reply from udevd. + + + Print help text. @@ -419,6 +443,18 @@ + + udevadm test-builtin <optional>options</optional> <replaceable>command</replaceable> <replaceable>devpath</replaceable> + Run a built-in command for the given device, and print debug output. + + + + + Print help text. + + + + Author diff --git a/udev/udevd.8 b/udev/udevd.8 index 453f968..4b001f0 100644 --- a/udev/udevd.8 +++ b/udev/udevd.8 @@ -1,13 +1,22 @@ '\" t .\" Title: udevd .\" Author: [see the "Author" section] -.\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 02/10/2011 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 10/19/2011 .\" Manual: udevd .\" Source: udev .\" Language: English .\" -.TH "UDEVD" "8" "02/10/2011" "udev" "udevd" +.TH "UDEVD" "8" "10/19/2011" "udev" "udevd" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/udev/udevd.c b/udev/udevd.c index aa2e365..05d4b2d 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Kay Sievers + * Copyright (C) 2004-2011 Kay Sievers * Copyright (C) 2004 Chris Friesen * Copyright (C) 2009 Canonical Ltd. * Copyright (C) 2009 Scott James Remnant @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include @@ -47,9 +47,6 @@ #include "udev.h" #include "sd-daemon.h" -#define UDEVD_PRIORITY -4 -#define UDEV_PRIORITY -2 - static bool debug; static void log_fn(struct udev *udev, int priority, @@ -58,13 +55,12 @@ static void log_fn(struct udev *udev, int priority, { if (debug) { char buf[1024]; - struct timeval tv; - struct timezone tz; + struct timespec ts; vsnprintf(buf, sizeof(buf), format, args); - gettimeofday(&tv, &tz); - fprintf(stderr, "%llu.%06u [%u] %s: %s", - (unsigned long long) tv.tv_sec, (unsigned int) tv.tv_usec, + clock_gettime(CLOCK_MONOTONIC, &ts); + fprintf(stderr, "[%llu.%06u] [%u] %s: %s", + (unsigned long long) ts.tv_sec, (unsigned int) ts.tv_nsec/1000, (int) getpid(), fn, buf); } else { vsyslog(priority, format, args); @@ -75,34 +71,19 @@ static struct udev_rules *rules; static struct udev_queue_export *udev_queue_export; static struct udev_ctrl *udev_ctrl; static struct udev_monitor *monitor; -static int worker_watch[2]; -static pid_t settle_pid; +static int worker_watch[2] = { -1, -1 }; +static int fd_signal = -1; +static int fd_ep = -1; +static int fd_inotify = -1; static bool stop_exec_queue; static bool reload_config; static int children; static int children_max; static int exec_delay; -static sigset_t orig_sigmask; -static struct udev_list_node event_list; -static struct udev_list_node worker_list; +static sigset_t sigmask_orig; +static UDEV_LIST(event_list); +static UDEV_LIST(worker_list); static bool udev_exit; -static volatile sig_atomic_t worker_exit; - -enum poll_fd { - FD_CONTROL, - FD_NETLINK, - FD_INOTIFY, - FD_SIGNAL, - FD_WORKER, -}; - -static struct pollfd pfd[] = { - [FD_NETLINK] = { .events = POLLIN }, - [FD_WORKER] = { .events = POLLIN }, - [FD_SIGNAL] = { .events = POLLIN }, - [FD_INOTIFY] = { .events = POLLIN }, - [FD_CONTROL] = { .events = POLLIN }, -}; enum event_state { EVENT_UNDEF, @@ -135,6 +116,8 @@ static struct event *node_to_event(struct udev_list_node *node) return (struct event *)event; } +static void event_queue_cleanup(struct udev *udev, enum event_state type); + enum worker_state { WORKER_UNDEF, WORKER_RUNNING, @@ -167,61 +150,61 @@ static struct worker *node_to_worker(struct udev_list_node *node) return (struct worker *)worker; } -static void event_queue_delete(struct event *event) +static void event_queue_delete(struct event *event, bool export) { udev_list_node_remove(&event->node); - /* mark as failed, if "add" event returns non-zero */ - if (event->exitcode != 0 && strcmp(udev_device_get_action(event->dev), "remove") != 0) - udev_queue_export_device_failed(udev_queue_export, event->dev); - else + if (export) { udev_queue_export_device_finished(udev_queue_export, event->dev); - - info(event->udev, "seq %llu done with %i\n", udev_device_get_seqnum(event->dev), event->exitcode); + info(event->udev, "seq %llu done with %i\n", udev_device_get_seqnum(event->dev), event->exitcode); + } udev_device_unref(event->dev); free(event); } -static void event_sig_handler(int signum) -{ - switch (signum) { - case SIGALRM: - _exit(1); - break; - case SIGTERM: - worker_exit = true; - break; - } -} - static struct worker *worker_ref(struct worker *worker) { worker->refcount++; return worker; } +static void worker_cleanup(struct worker *worker) +{ + udev_list_node_remove(&worker->node); + udev_monitor_unref(worker->monitor); + children--; + free(worker); +} + static void worker_unref(struct worker *worker) { worker->refcount--; if (worker->refcount > 0) return; - - udev_list_node_remove(&worker->node); - udev_monitor_unref(worker->monitor); - children--; info(worker->udev, "worker [%u] cleaned up\n", worker->pid); - free(worker); + worker_cleanup(worker); +} + +static void worker_list_cleanup(struct udev *udev) +{ + struct udev_list_node *loop, *tmp; + + udev_list_node_foreach_safe(loop, tmp, &worker_list) { + struct worker *worker = node_to_worker(loop); + + worker_cleanup(worker); + } } static void worker_new(struct event *event) { + struct udev *udev = event->udev; struct worker *worker; struct udev_monitor *worker_monitor; pid_t pid; - struct sigaction act; /* listen for new events */ - worker_monitor = udev_monitor_new_from_netlink(event->udev, NULL); + worker_monitor = udev_monitor_new_from_netlink(udev, NULL); if (worker_monitor == NULL) return; /* allow the main daemon netlink address to send devices to the worker */ @@ -235,80 +218,92 @@ static void worker_new(struct event *event) } /* worker + event reference */ worker->refcount = 2; - worker->udev = event->udev; + worker->udev = udev; pid = fork(); switch (pid) { case 0: { - sigset_t sigmask; - struct udev_device *dev; - struct pollfd pmon = { - .fd = udev_monitor_get_fd(worker_monitor), - .events = POLLIN, - }; + struct udev_device *dev = NULL; + int fd_monitor; + struct epoll_event ep_signal, ep_monitor; + sigset_t mask; + int rc = EXIT_SUCCESS; + /* move initial device from queue */ + dev = event->dev; + event->dev = NULL; + + free(worker); + worker_list_cleanup(udev); + event_queue_cleanup(udev, EVENT_UNDEF); udev_queue_export_unref(udev_queue_export); udev_monitor_unref(monitor); udev_ctrl_unref(udev_ctrl); - close(pfd[FD_SIGNAL].fd); + close(fd_signal); + close(fd_ep); close(worker_watch[READ_END]); - udev_log_close(); - udev_log_init("udevd-work"); - setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); - - /* set signal handlers */ - memset(&act, 0x00, sizeof(act)); - act.sa_handler = event_sig_handler; - sigemptyset (&act.sa_mask); - act.sa_flags = 0; - sigaction(SIGTERM, &act, NULL); - sigaction(SIGALRM, &act, NULL); - - /* unblock SIGALRM */ - sigfillset(&sigmask); - sigdelset(&sigmask, SIGALRM); - sigprocmask(SIG_SETMASK, &sigmask, NULL); - /* SIGTERM is unblocked in ppoll() */ - sigdelset(&sigmask, SIGTERM); + + sigfillset(&mask); + fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); + if (fd_signal < 0) { + err(udev, "error creating signalfd %m\n"); + rc = 2; + goto out; + } + + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + err(udev, "error creating epoll fd: %m\n"); + rc = 3; + goto out; + } + + memset(&ep_signal, 0, sizeof(struct epoll_event)); + ep_signal.events = EPOLLIN; + ep_signal.data.fd = fd_signal; + + fd_monitor = udev_monitor_get_fd(worker_monitor); + memset(&ep_monitor, 0, sizeof(struct epoll_event)); + ep_monitor.events = EPOLLIN; + ep_monitor.data.fd = fd_monitor; + + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_signal, &ep_signal) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_monitor, &ep_monitor) < 0) { + err(udev, "fail to add fds to epoll: %m\n"); + rc = 4; + goto out; + } /* request TERM signal if parent exits */ prctl(PR_SET_PDEATHSIG, SIGTERM); - /* initial device */ - dev = event->dev; - - do { + for (;;) { struct udev_event *udev_event; - struct worker_message msg = {}; + struct worker_message msg; int err; - int failed = 0; - info(event->udev, "seq %llu running\n", udev_device_get_seqnum(dev)); + info(udev, "seq %llu running\n", udev_device_get_seqnum(dev)); udev_event = udev_event_new(dev); - if (udev_event == NULL) - _exit(3); + if (udev_event == NULL) { + rc = 5; + goto out; + } - /* set timeout to prevent hanging processes */ - alarm(UDEV_EVENT_TIMEOUT); + /* needed for SIGCHLD/SIGTERM in spawn() */ + udev_event->fd_signal = fd_signal; if (exec_delay > 0) udev_event->exec_delay = exec_delay; /* apply rules, create node, symlinks */ - err = udev_event_execute_rules(udev_event, rules); - - /* rules may change/disable the timeout */ - if (udev_device_get_event_timeout(dev) >= 0) - alarm(udev_device_get_event_timeout(dev)); + err = udev_event_execute_rules(udev_event, rules, &sigmask_orig); if (err == 0) - failed = udev_event_execute_run(udev_event, &orig_sigmask); - - alarm(0); + udev_event_execute_run(udev_event, &sigmask_orig); /* apply/restore inotify watch */ if (err == 0 && udev_event->inotify_watch) { - udev_watch_begin(udev_event->udev, dev); + udev_watch_begin(udev, dev); udev_device_update_db(dev); } @@ -316,43 +311,77 @@ static void worker_new(struct event *event) udev_monitor_send_device(worker_monitor, NULL, dev); /* send udevd the result of the event execution */ + memset(&msg, 0, sizeof(struct worker_message)); if (err != 0) msg.exitcode = err; - else if (failed != 0) - msg.exitcode = failed; msg.pid = getpid(); send(worker_watch[WRITE_END], &msg, sizeof(struct worker_message), 0); - info(event->udev, "seq %llu processed with %i\n", udev_device_get_seqnum(dev), err); - udev_event_unref(udev_event); + info(udev, "seq %llu processed with %i\n", udev_device_get_seqnum(dev), err); + udev_device_unref(dev); dev = NULL; - /* wait for more device messages or signal from udevd */ - while (!worker_exit) { - int fdcount; + if (udev_event->sigterm) { + udev_event_unref(udev_event); + goto out; + } - fdcount = ppoll(&pmon, 1, NULL, &sigmask); - if (fdcount < 0) - continue; + udev_event_unref(udev_event); - if (pmon.revents & POLLIN) { - dev = udev_monitor_receive_device(worker_monitor); - if (dev != NULL) + /* wait for more device messages from main udevd, or term signal */ + while (dev == NULL) { + struct epoll_event ev[4]; + int fdcount; + int i; + + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); + if (fdcount < 0) { + if (errno == EINTR) + continue; + err = -errno; + err(udev, "failed to poll: %m\n"); + goto out; + } + + for (i = 0; i < fdcount; i++) { + if (ev[i].data.fd == fd_monitor && ev[i].events & EPOLLIN) { + dev = udev_monitor_receive_device(worker_monitor); break; + } else if (ev[i].data.fd == fd_signal && ev[i].events & EPOLLIN) { + struct signalfd_siginfo fdsi; + ssize_t size; + + size = read(fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); + if (size != sizeof(struct signalfd_siginfo)) + continue; + switch (fdsi.ssi_signo) { + case SIGTERM: + goto out; + } + } } } - } while (dev != NULL); - + } +out: + udev_device_unref(dev); + if (fd_signal >= 0) + close(fd_signal); + if (fd_ep >= 0) + close(fd_ep); + close(fd_inotify); + close(worker_watch[WRITE_END]); + udev_rules_unref(rules); udev_monitor_unref(worker_monitor); + udev_unref(udev); udev_log_close(); - exit(0); + exit(rc); } case -1: udev_monitor_unref(worker_monitor); event->state = EVENT_QUEUED; free(worker); - err(event->udev, "fork of child failed: %m\n"); + err(udev, "fork of child failed: %m\n"); break; default: /* close monitor, but keep address around */ @@ -364,7 +393,7 @@ static void worker_new(struct event *event) event->state = EVENT_RUNNING; udev_list_node_append(&worker->node, &worker_list); children++; - info(event->udev, "seq %llu forked new worker [%u]\n", udev_device_get_seqnum(event->dev), pid); + info(udev, "seq %llu forked new worker [%u]\n", udev_device_get_seqnum(event->dev), pid); break; } } @@ -535,7 +564,7 @@ static bool is_devpath_busy(struct event *event) return false; } -static void events_start(struct udev *udev) +static void event_queue_start(struct udev *udev) { struct udev_list_node *loop; @@ -555,14 +584,28 @@ static void events_start(struct udev *udev) } } -static void worker_returned(void) +static void event_queue_cleanup(struct udev *udev, enum event_state match_type) +{ + struct udev_list_node *loop, *tmp; + + udev_list_node_foreach_safe(loop, tmp, &event_list) { + struct event *event = node_to_event(loop); + + if (match_type != EVENT_UNDEF && match_type != event->state) + continue; + + event_queue_delete(event, false); + } +} + +static void worker_returned(int fd_worker) { for (;;) { struct worker_message msg; ssize_t size; struct udev_list_node *loop; - size = recv(pfd[FD_WORKER].fd, &msg, sizeof(struct worker_message), MSG_DONTWAIT); + size = recv(fd_worker, &msg, sizeof(struct worker_message), MSG_DONTWAIT); if (size != sizeof(struct worker_message)) break; @@ -575,7 +618,7 @@ static void worker_returned(void) /* worker returned */ worker->event->exitcode = msg.exitcode; - event_queue_delete(worker->event); + event_queue_delete(worker->event, true); worker->event = NULL; if (worker->state != WORKER_KILLED) worker->state = WORKER_IDLE; @@ -586,16 +629,21 @@ static void worker_returned(void) } /* receive the udevd message from userspace */ -static void handle_ctrl_msg(struct udev_ctrl *uctrl) +static struct udev_ctrl_connection *handle_ctrl_msg(struct udev_ctrl *uctrl) { struct udev *udev = udev_ctrl_get_udev(uctrl); - struct udev_ctrl_msg *ctrl_msg; + struct udev_ctrl_connection *ctrl_conn; + struct udev_ctrl_msg *ctrl_msg = NULL; const char *str; int i; - ctrl_msg = udev_ctrl_receive_msg(uctrl); + ctrl_conn = udev_ctrl_get_connection(uctrl); + if (ctrl_conn == NULL) + goto out; + + ctrl_msg = udev_ctrl_receive_msg(ctrl_conn); if (ctrl_msg == NULL) - return; + goto out; i = udev_ctrl_get_set_log_level(ctrl_msg); if (i >= 0) { @@ -652,13 +700,18 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) children_max = i; } - settle_pid = udev_ctrl_get_settle(ctrl_msg); - if (settle_pid > 0) { - info(udev, "udevd message (SETTLE) received\n"); - kill(settle_pid, SIGUSR1); - settle_pid = 0; + if (udev_ctrl_get_ping(ctrl_msg) > 0) + info(udev, "udevd message (SYNC) received\n"); + + if (udev_ctrl_get_exit(ctrl_msg) > 0) { + info(udev, "udevd message (EXIT) received\n"); + udev_exit = true; + /* keep reference to block the client until we exit */ + udev_ctrl_connection_ref(ctrl_conn); } +out: udev_ctrl_msg_unref(ctrl_msg); + return udev_ctrl_connection_unref(ctrl_conn); } /* read inotify messages */ @@ -668,7 +721,7 @@ static int handle_inotify(struct udev *udev) char *buf; struct inotify_event *ev; - if ((ioctl(pfd[FD_INOTIFY].fd, FIONREAD, &nbytes) < 0) || (nbytes <= 0)) + if ((ioctl(fd_inotify, FIONREAD, &nbytes) < 0) || (nbytes <= 0)) return 0; buf = malloc(nbytes); @@ -677,7 +730,7 @@ static int handle_inotify(struct udev *udev) return -1; } - nbytes = read(pfd[FD_INOTIFY].fd, buf, nbytes); + nbytes = read(fd_inotify, buf, nbytes); for (pos = 0; pos < nbytes; pos += sizeof(struct inotify_event) + ev->len) { struct udev_device *dev; @@ -706,9 +759,11 @@ static int handle_inotify(struct udev *udev) info(udev, "device %s closed, synthesising 'change'\n", udev_device_get_devnode(dev)); util_strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); fd = open(filename, O_WRONLY); - if (fd < 0 || write(fd, "change", 6) < 0) - info(udev, "error writing uevent: %m\n"); - close(fd); + if (fd >= 0) { + if (write(fd, "change", 6) < 0) + info(udev, "error writing uevent: %m\n"); + close(fd); + } } if (ev->mask & IN_IGNORED) udev_watch_end(udev, dev); @@ -744,15 +799,29 @@ static void handle_signal(struct udev *udev, int signo) if (worker->pid != pid) continue; - info(udev, "worker [%u] exit\n", pid); + + if (WIFEXITED(status)) { + if (WEXITSTATUS(status) != 0) + err(udev, "worker [%u] exit with return code %i\n", pid, WEXITSTATUS(status)); + } else if (WIFSIGNALED(status)) { + err(udev, "worker [%u] terminated by signal %i (%s)\n", + pid, WTERMSIG(status), strsignal(WTERMSIG(status))); + } else if (WIFSTOPPED(status)) { + err(udev, "worker [%u] stopped\n", pid); + } else if (WIFCONTINUED(status)) { + err(udev, "worker [%u] continued\n", pid); + } else { + err(udev, "worker [%u] exit with status 0x%04x\n", pid, status); + } + if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { - err(udev, "worker [%u] unexpectedly returned with status 0x%04x\n", pid, status); if (worker->event != NULL) { - err(udev, "worker [%u] failed while handling '%s'\n", pid, worker->event->devpath); + err(udev, "worker [%u] failed while handling '%s'\n", + pid, worker->event->devpath); worker->event->exitcode = -32; - event_queue_delete(worker->event); - /* drop reference from running event */ + event_queue_delete(worker->event, true); + /* drop reference taken for state 'running' */ worker_unref(worker); } } @@ -814,15 +883,16 @@ static void static_dev_create_from_modules(struct udev *udev) if (sscanf(devno, "%c%u:%u", &type, &maj, &min) != 3) continue; + /* set sticky bit, so we do not remove the node on module unload */ if (type == 'c') - mode = 0600 | S_IFCHR; + mode = 01600|S_IFCHR; else if (type == 'b') - mode = 0600 | S_IFBLK; + mode = 01600|S_IFBLK; else continue; util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/", devname, NULL); - util_create_path(udev, filename); + util_create_path_selinux(udev, filename); udev_selinux_setfscreatecon(udev, filename, mode); info(udev, "mknod '%s' %c%u:%u\n", filename, type, maj, min); if (mknod(filename, mode, makedev(maj, min)) < 0 && errno == EEXIST) @@ -833,7 +903,7 @@ static void static_dev_create_from_modules(struct udev *udev) fclose(f); } -static int copy_dir(struct udev *udev, DIR *dir_from, DIR *dir_to, int maxdepth) +static int copy_dev_dir(struct udev *udev, DIR *dir_from, DIR *dir_to, int maxdepth) { struct dirent *dent; @@ -886,7 +956,7 @@ static int copy_dir(struct udev *udev, DIR *dir_from, DIR *dir_to, int maxdepth) continue; } - copy_dir(udev, dir2_from, dir2_to, maxdepth-1); + copy_dev_dir(udev, dir2_from, dir2_to, maxdepth-1); closedir(dir2_to); closedir(dir2_from); @@ -930,7 +1000,7 @@ static void static_dev_create_from_devices(struct udev *udev, DIR *dir) dir_from = opendir(LIBEXECDIR "/devices"); if (dir_from == NULL) return; - copy_dir(udev, dir_from, dir, 8); + copy_dev_dir(udev, dir_from, dir, 8); closedir(dir_from); } @@ -971,10 +1041,137 @@ static int mem_size_mb(void) return memsize; } +static int convert_db(struct udev *udev) +{ + char filename[UTIL_PATH_SIZE]; + FILE *f; + struct udev_enumerate *udev_enumerate; + struct udev_list_entry *list_entry; + + /* current database */ + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data", NULL); + if (access(filename, F_OK) >= 0) + return 0; + + /* make sure we do not get here again */ + util_create_path(udev, filename); + mkdir(filename, 0755); + + /* old database */ + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db", NULL); + if (access(filename, F_OK) < 0) + return 0; + + f = fopen("/dev/kmsg", "w"); + if (f != NULL) { + fprintf(f, "<30>udevd[%u]: converting old udev database\n", getpid()); + fclose(f); + } + + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_scan_devices(udev_enumerate); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { + struct udev_device *device; + + device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); + if (device == NULL) + continue; + + /* try to find the old database for devices without a current one */ + if (udev_device_read_db(device, NULL) < 0) { + bool have_db; + const char *id; + struct stat stats; + char devpath[UTIL_PATH_SIZE]; + char from[UTIL_PATH_SIZE]; + + have_db = false; + + /* find database in old location */ + id = udev_device_get_id_filename(device); + util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), "/.udev/db/", id, NULL); + if (lstat(from, &stats) == 0) { + if (!have_db) { + udev_device_read_db(device, from); + have_db = true; + } + unlink(from); + } + + /* find old database with $subsys:$sysname name */ + util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), + "/.udev/db/", udev_device_get_subsystem(device), ":", + udev_device_get_sysname(device), NULL); + if (lstat(from, &stats) == 0) { + if (!have_db) { + udev_device_read_db(device, from); + have_db = true; + } + unlink(from); + } + + /* find old database with the encoded devpath name */ + util_path_encode(udev_device_get_devpath(device), devpath, sizeof(devpath)); + util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), "/.udev/db/", devpath, NULL); + if (lstat(from, &stats) == 0) { + if (!have_db) { + udev_device_read_db(device, from); + have_db = true; + } + unlink(from); + } + + /* write out new database */ + if (have_db) + udev_device_update_db(device); + } + udev_device_unref(device); + } + udev_enumerate_unref(udev_enumerate); + return 0; +} + +static int systemd_fds(struct udev *udev, int *rctrl, int *rnetlink) +{ + int ctrl = -1, netlink = -1; + int fd, n; + + n = sd_listen_fds(true); + if (n <= 0) + return -1; + + for (fd = SD_LISTEN_FDS_START; fd < n + SD_LISTEN_FDS_START; fd++) { + if (sd_is_socket(fd, AF_LOCAL, SOCK_SEQPACKET, -1)) { + if (ctrl >= 0) + return -1; + ctrl = fd; + continue; + } + + if (sd_is_socket(fd, AF_NETLINK, SOCK_RAW, -1)) { + if (netlink >= 0) + return -1; + netlink = fd; + continue; + } + + return -1; + } + + if (ctrl < 0 || netlink < 0) + return -1; + + info(udev, "ctrl=%i netlink=%i\n", ctrl, netlink); + *rctrl = ctrl; + *rnetlink = netlink; + return 0; +} + int main(int argc, char *argv[]) { struct udev *udev; - int fd; FILE *f; sigset_t mask; int daemonize = false; @@ -989,6 +1186,11 @@ int main(int argc, char *argv[]) { "version", no_argument, NULL, 'V' }, {} }; + int fd_ctrl = -1; + int fd_netlink = -1; + int fd_worker = -1; + struct epoll_event ep_ctrl, ep_inotify, ep_signal, ep_netlink, ep_worker; + struct udev_ctrl_connection *ctrl_conn = NULL; int rc = 1; udev = udev_new(); @@ -1000,10 +1202,35 @@ int main(int argc, char *argv[]) info(udev, "version %s\n", VERSION); udev_selinux_init(udev); + /* make sure, that our runtime dir exists and is writable */ + if (utimensat(AT_FDCWD, udev_get_run_config_path(udev), NULL, 0) < 0) { + /* try to create our own subdirectory, do not create parent directories */ + mkdir(udev_get_run_config_path(udev), 0755); + + if (utimensat(AT_FDCWD, udev_get_run_config_path(udev), NULL, 0) >= 0) { + /* directory seems writable now */ + udev_set_run_path(udev, udev_get_run_config_path(udev)); + } else { + /* fall back to /dev/.udev */ + char filename[UTIL_PATH_SIZE]; + + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev", NULL); + if (udev_set_run_path(udev, filename) == NULL) + goto exit; + mkdir(udev_get_run_path(udev), 0755); + err(udev, "error: runtime directory '%s' not writable, for now falling back to '%s'", + udev_get_run_config_path(udev), udev_get_run_path(udev)); + } + } + /* relabel runtime dir only if it resides below /dev */ + if (strncmp(udev_get_run_path(udev), udev_get_dev_path(udev), strlen(udev_get_dev_path(udev))) == 0) + udev_selinux_lsetfilecon(udev, udev_get_run_path(udev), 0755); + info(udev, "runtime dir '%s'\n", udev_get_run_path(udev)); + for (;;) { int option; - option = getopt_long(argc, argv, "c:deDthV", options, NULL); + option = getopt_long(argc, argv, "c:deDtN:hV", options, NULL); if (option == -1) break; @@ -1103,43 +1330,140 @@ int main(int argc, char *argv[]) static_dev_create_from_modules(udev); /* before opening new files, make sure std{in,out,err} fds are in a sane state */ - fd = open("/dev/null", O_RDWR); - if (fd < 0) { - fprintf(stderr, "cannot open /dev/null\n"); - err(udev, "cannot open /dev/null\n"); + if (daemonize) { + int fd; + + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + if (write(STDOUT_FILENO, 0, 0) < 0) + dup2(fd, STDOUT_FILENO); + if (write(STDERR_FILENO, 0, 0) < 0) + dup2(fd, STDERR_FILENO); + if (fd > STDERR_FILENO) + close(fd); + } else { + fprintf(stderr, "cannot open /dev/null\n"); + err(udev, "cannot open /dev/null\n"); + } } - if (write(STDOUT_FILENO, 0, 0) < 0) - dup2(fd, STDOUT_FILENO); - if (write(STDERR_FILENO, 0, 0) < 0) - dup2(fd, STDERR_FILENO); - - udev_ctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); - if (udev_ctrl == NULL) { - fprintf(stderr, "error initializing control socket"); - err(udev, "error initializing udevd socket"); - rc = 1; + + if (systemd_fds(udev, &fd_ctrl, &fd_netlink) >= 0) { + /* get control and netlink socket from from systemd */ + udev_ctrl = udev_ctrl_new_from_fd(udev, fd_ctrl); + if (udev_ctrl == NULL) { + err(udev, "error taking over udev control socket"); + rc = 1; + goto exit; + } + + monitor = udev_monitor_new_from_netlink_fd(udev, "kernel", fd_netlink); + if (monitor == NULL) { + err(udev, "error taking over netlink socket\n"); + rc = 3; + goto exit; + } + } else { + /* open control and netlink socket */ + udev_ctrl = udev_ctrl_new(udev); + if (udev_ctrl == NULL) { + fprintf(stderr, "error initializing udev control socket"); + err(udev, "error initializing udev control socket"); + rc = 1; + goto exit; + } + fd_ctrl = udev_ctrl_get_fd(udev_ctrl); + + monitor = udev_monitor_new_from_netlink(udev, "kernel"); + if (monitor == NULL) { + fprintf(stderr, "error initializing netlink socket\n"); + err(udev, "error initializing netlink socket\n"); + rc = 3; + goto exit; + } + fd_netlink = udev_monitor_get_fd(monitor); + } + + if (udev_monitor_enable_receiving(monitor) < 0) { + fprintf(stderr, "error binding netlink socket\n"); + err(udev, "error binding netlink socket\n"); + rc = 3; goto exit; } + if (udev_ctrl_enable_receiving(udev_ctrl) < 0) { - fprintf(stderr, "error binding control socket, seems udevd is already running\n"); - err(udev, "error binding control socket, seems udevd is already running\n"); + fprintf(stderr, "error binding udev control socket\n"); + err(udev, "error binding udev control socket\n"); rc = 1; goto exit; } - pfd[FD_CONTROL].fd = udev_ctrl_get_fd(udev_ctrl); - monitor = udev_monitor_new_from_netlink(udev, "kernel"); - if (monitor == NULL || udev_monitor_enable_receiving(monitor) < 0) { - fprintf(stderr, "error initializing netlink socket\n"); - err(udev, "error initializing netlink socket\n"); - rc = 3; + udev_monitor_set_receive_buffer_size(monitor, 128*1024*1024); + + /* create queue file before signalling 'ready', to make sure we block 'settle' */ + udev_queue_export = udev_queue_export_new(udev); + if (udev_queue_export == NULL) { + err(udev, "error creating queue file\n"); goto exit; } - udev_monitor_set_receive_buffer_size(monitor, 128*1024*1024); - pfd[FD_NETLINK].fd = udev_monitor_get_fd(monitor); - pfd[FD_INOTIFY].fd = udev_watch_init(udev); - if (pfd[FD_INOTIFY].fd < 0) { + if (daemonize) { + pid_t pid; + int fd; + + pid = fork(); + switch (pid) { + case 0: + break; + case -1: + err(udev, "fork of daemon failed: %m\n"); + rc = 4; + goto exit; + default: + rc = EXIT_SUCCESS; + goto exit_daemonize; + } + + setsid(); + + fd = open("/proc/self/oom_score_adj", O_RDWR); + if (fd < 0) { + /* Fallback to old interface */ + fd = open("/proc/self/oom_adj", O_RDWR); + if (fd < 0) { + err(udev, "error disabling OOM: %m\n"); + } else { + /* OOM_DISABLE == -17 */ + write(fd, "-17", 3); + close(fd); + } + } else { + write(fd, "-1000", 5); + close(fd); + } + } else { + sd_notify(1, "READY=1"); + } + + f = fopen("/dev/kmsg", "w"); + if (f != NULL) { + fprintf(f, "<30>udevd[%u]: starting version " VERSION "\n", getpid()); + fclose(f); + } + + if (!debug) { + int fd; + + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + dup2(fd, STDIN_FILENO); + dup2(fd, STDOUT_FILENO); + dup2(fd, STDERR_FILENO); + close(fd); + } + } + + fd_inotify = udev_watch_init(udev); + if (fd_inotify < 0) { fprintf(stderr, "error initializing inotify\n"); err(udev, "error initializing inotify\n"); rc = 4; @@ -1147,49 +1471,47 @@ int main(int argc, char *argv[]) } if (udev_get_rules_path(udev) != NULL) { - inotify_add_watch(pfd[FD_INOTIFY].fd, udev_get_rules_path(udev), + inotify_add_watch(fd_inotify, udev_get_rules_path(udev), IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); } else { char filename[UTIL_PATH_SIZE]; struct stat statbuf; - inotify_add_watch(pfd[FD_INOTIFY].fd, LIBEXECDIR "/rules.d", + inotify_add_watch(fd_inotify, LIBEXECDIR "/rules.d", IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - inotify_add_watch(pfd[FD_INOTIFY].fd, SYSCONFDIR "/udev/rules.d", + inotify_add_watch(fd_inotify, SYSCONFDIR "/udev/rules.d", IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); /* watch dynamic rules directory */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/rules.d", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/rules.d", NULL); if (stat(filename, &statbuf) != 0) { util_create_path(udev, filename); - udev_selinux_setfscreatecon(udev, filename, S_IFDIR|0755); mkdir(filename, 0755); - udev_selinux_resetfscreatecon(udev); } - inotify_add_watch(pfd[FD_INOTIFY].fd, filename, + inotify_add_watch(fd_inotify, filename, IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); } udev_watch_restore(udev); /* block and listen to all signals on signalfd */ sigfillset(&mask); - sigprocmask(SIG_SETMASK, &mask, &orig_sigmask); - pfd[FD_SIGNAL].fd = signalfd(-1, &mask, 0); - if (pfd[FD_SIGNAL].fd < 0) { - fprintf(stderr, "error getting signalfd\n"); - err(udev, "error getting signalfd\n"); + sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); + fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); + if (fd_signal < 0) { + fprintf(stderr, "error creating signalfd\n"); + err(udev, "error creating signalfd\n"); rc = 5; goto exit; } /* unnamed socket from workers to the main daemon */ if (socketpair(AF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0, worker_watch) < 0) { - fprintf(stderr, "error getting socketpair\n"); - err(udev, "error getting socketpair\n"); + fprintf(stderr, "error creating socketpair\n"); + err(udev, "error creating socketpair\n"); rc = 6; goto exit; } - pfd[FD_WORKER].fd = worker_watch[READ_END]; + fd_worker = worker_watch[READ_END]; rules = udev_rules_new(udev, resolve_names); if (rules == NULL) { @@ -1197,66 +1519,43 @@ int main(int argc, char *argv[]) goto exit; } - udev_queue_export = udev_queue_export_new(udev); - if (udev_queue_export == NULL) { - err(udev, "error creating queue file\n"); - goto exit; - } + memset(&ep_ctrl, 0, sizeof(struct epoll_event)); + ep_ctrl.events = EPOLLIN; + ep_ctrl.data.fd = fd_ctrl; - if (!debug) { - dup2(fd, STDIN_FILENO); - dup2(fd, STDOUT_FILENO); - dup2(fd, STDERR_FILENO); - } - if (fd > STDERR_FILENO) - close(fd); - - if (daemonize) { - pid_t pid; + memset(&ep_inotify, 0, sizeof(struct epoll_event)); + ep_inotify.events = EPOLLIN; + ep_inotify.data.fd = fd_inotify; - pid = fork(); - switch (pid) { - case 0: - break; - case -1: - err(udev, "fork of daemon failed: %m\n"); - rc = 4; - goto exit; - default: - rc = 0; - goto exit; - } - } else { - sd_notify(1, "READY=1"); - } + memset(&ep_signal, 0, sizeof(struct epoll_event)); + ep_signal.events = EPOLLIN; + ep_signal.data.fd = fd_signal; - /* set scheduling priority for the main daemon process */ - setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); + memset(&ep_netlink, 0, sizeof(struct epoll_event)); + ep_netlink.events = EPOLLIN; + ep_netlink.data.fd = fd_netlink; - setsid(); + memset(&ep_worker, 0, sizeof(struct epoll_event)); + ep_worker.events = EPOLLIN; + ep_worker.data.fd = fd_worker; - f = fopen("/dev/kmsg", "w"); - if (f != NULL) { - fprintf(f, "<6>udev[%u]: starting version " VERSION "\n", getpid()); - fclose(f); + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + err(udev, "error creating epoll fd: %m\n"); + goto exit; } - - fd = open("/proc/self/oom_score_adj", O_RDWR); - if (fd < 0) { - /* Fallback to old interface */ - fd = open("/proc/self/oom_adj", O_RDWR); - if (fd < 0) { - err(udev, "error disabling OOM: %m\n"); - } else { - /* OOM_DISABLE == -17 */ - write(fd, "-17", 3); - close(fd); - } - } else { - write(fd, "-1000", 5); - close(fd); + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_ctrl, &ep_ctrl) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_inotify, &ep_inotify) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_signal, &ep_signal) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_netlink, &ep_netlink) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_worker, &ep_worker) < 0) { + err(udev, "fail to add fds to epoll: %m\n"); + goto exit; } + /* if needed, convert old database from earlier udev version */ + convert_db(udev); + if (children_max <= 0) { int memsize = mem_size_mb(); @@ -1270,68 +1569,124 @@ int main(int argc, char *argv[]) udev_rules_apply_static_dev_perms(rules); - udev_list_init(&event_list); - udev_list_init(&worker_list); + udev_list_node_init(&event_list); + udev_list_node_init(&worker_list); - while (!udev_exit) { + for (;;) { + struct epoll_event ev[8]; int fdcount; int timeout; + bool is_worker, is_signal, is_inotify, is_netlink, is_ctrl; + int i; + + if (udev_exit) { + /* close sources of new events and discard buffered events */ + if (fd_ctrl >= 0) { + epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_ctrl, NULL); + fd_ctrl = -1; + } + if (monitor != NULL) { + epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_netlink, NULL); + udev_monitor_unref(monitor); + monitor = NULL; + } + if (fd_inotify >= 0) { + epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_inotify, NULL); + close(fd_inotify); + fd_inotify = -1; + } + + /* discard queued events and kill workers */ + event_queue_cleanup(udev, EVENT_QUEUED); + worker_kill(udev, 0); + + /* exit after all has cleaned up */ + if (udev_list_node_is_empty(&event_list) && udev_list_node_is_empty(&worker_list)) + break; - /* set timeout to kill idle workers */ - if (udev_list_is_empty(&event_list) && children > 2) + /* timeout at exit for workers to finish */ + timeout = 60 * 1000; + } else if (udev_list_node_is_empty(&event_list) && children > 2) { + /* set timeout to kill idle workers */ timeout = 3 * 1000; - else + } else { timeout = -1; - /* wait for events */ - fdcount = poll(pfd, ARRAY_SIZE(pfd), timeout); + } + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), timeout); if (fdcount < 0) continue; - /* timeout - kill idle workers */ - if (fdcount == 0) + if (fdcount == 0) { + if (udev_exit) { + info(udev, "timeout, giving up waiting for workers to finish\n"); + break; + } + + /* timeout - kill idle workers */ worker_kill(udev, 2); + } + + is_worker = is_signal = is_inotify = is_netlink = is_ctrl = false; + for (i = 0; i < fdcount; i++) { + if (ev[i].data.fd == fd_worker && ev[i].events & EPOLLIN) + is_worker = true; + else if (ev[i].data.fd == fd_netlink && ev[i].events & EPOLLIN) + is_netlink = true; + else if (ev[i].data.fd == fd_signal && ev[i].events & EPOLLIN) + is_signal = true; + else if (ev[i].data.fd == fd_inotify && ev[i].events & EPOLLIN) + is_inotify = true; + else if (ev[i].data.fd == fd_ctrl && ev[i].events & EPOLLIN) + is_ctrl = true; + } /* event has finished */ - if (pfd[FD_WORKER].revents & POLLIN) - worker_returned(); + if (is_worker) + worker_returned(fd_worker); - /* get kernel uevent */ - if (pfd[FD_NETLINK].revents & POLLIN) { + if (is_netlink) { struct udev_device *dev; dev = udev_monitor_receive_device(monitor); - if (dev != NULL) + if (dev != NULL) { + udev_device_set_usec_initialized(dev, now_usec()); if (event_queue_insert(dev) < 0) udev_device_unref(dev); + } } /* start new events */ - if (!udev_list_is_empty(&event_list) && !stop_exec_queue) - events_start(udev); + if (!udev_list_node_is_empty(&event_list) && !udev_exit && !stop_exec_queue) + event_queue_start(udev); - /* get signal */ - if (pfd[FD_SIGNAL].revents & POLLIN) { + if (is_signal) { struct signalfd_siginfo fdsi; ssize_t size; - size = read(pfd[FD_SIGNAL].fd, &fdsi, sizeof(struct signalfd_siginfo)); + size = read(fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); if (size == sizeof(struct signalfd_siginfo)) handle_signal(udev, fdsi.ssi_signo); } + /* we are shutting down, the events below are not handled anymore */ + if (udev_exit) + continue; + /* device node and rules directory inotify watch */ - if (pfd[FD_INOTIFY].revents & POLLIN) + if (is_inotify) handle_inotify(udev); /* - * get control message - * * This needs to be after the inotify handling, to make sure, - * that the settle signal is send back after the possibly generated + * that the ping is send back after the possibly generated * "change" events by the inotify device node watch. + * + * A single time we may receive a client connection which we need to + * keep open to block the client. It will be closed right before we + * exit. */ - if (pfd[FD_CONTROL].revents & POLLIN) - handle_ctrl_msg(udev_ctrl); + if (is_ctrl) + ctrl_conn = handle_ctrl_msg(udev_ctrl); /* rules changed, set by inotify or a HUP signal */ if (reload_config) { @@ -1347,19 +1702,26 @@ int main(int argc, char *argv[]) } } - udev_queue_export_cleanup(udev_queue_export); - rc = 0; + rc = EXIT_SUCCESS; exit: - udev_queue_export_unref(udev_queue_export); + udev_queue_export_cleanup(udev_queue_export); + udev_ctrl_cleanup(udev_ctrl); +exit_daemonize: + if (fd_ep >= 0) + close(fd_ep); + worker_list_cleanup(udev); + event_queue_cleanup(udev, EVENT_UNDEF); udev_rules_unref(rules); - udev_ctrl_unref(udev_ctrl); - if (pfd[FD_SIGNAL].fd >= 0) - close(pfd[FD_SIGNAL].fd); + if (fd_signal >= 0) + close(fd_signal); if (worker_watch[READ_END] >= 0) close(worker_watch[READ_END]); if (worker_watch[WRITE_END] >= 0) close(worker_watch[WRITE_END]); udev_monitor_unref(monitor); + udev_queue_export_unref(udev_queue_export); + udev_ctrl_connection_unref(ctrl_conn); + udev_ctrl_unref(udev_ctrl); udev_selinux_exit(udev); udev_unref(udev); udev_log_close(); diff --git a/udev/udevd.html b/udev/udevd.html index 2962f05..e17628f 100644 --- a/udev/udevd.html +++ b/udev/udevd.html @@ -1,18 +1,18 @@ -udevd

Name

udevd — event managing daemon

Synopsis

udevd [--daemon] [--debug] [--children-max=] [--exec-delay=] [--resolve-names=early|late|never] [--version] [--help]

Description

udevd listens to kernel uevents. For every event, udevd executes matching +udevd

Name

udevd — event managing daemon

Synopsis

udevd [--daemon] [--debug] [--children-max=] [--exec-delay=] [--resolve-names=early|late|never] [--version] [--help]

Options

--daemon

Detach and run in the background.

--debug

Print debug messages to stderr.

--children-max=

Limit the number of parallel executed events.

--exec-delay=

Number of seconds to delay the execution of RUN instructions. + udevadm control.

+ cause by loading non-working kernel modules.

-- 2.7.4