test-udev.c revision 220893b3cbdbf8932f95c44811b169a8f0d33939
39cff5961ab5d08c9685d5c2c43152aafe2b7285Kay Sievers * Copyright (C) 2003-2004 Greg Kroah-Hartman <greg@kroah.com>
39cff5961ab5d08c9685d5c2c43152aafe2b7285Kay Sievers * Copyright (C) 2004-2008 Kay Sievers <kay.sievers@vrfy.org>
7c66aeba0f28cb82027d6015405ed71afa3b6059Kay Sievers * This program is free software: you can redistribute it and/or modify
7c66aeba0f28cb82027d6015405ed71afa3b6059Kay Sievers * it under the terms of the GNU General Public License as published by
c904f64d84db8c4eebedf210ba10893f19ba05edLennart Poettering * the Free Software Foundation, either version 2 of the License, or
c904f64d84db8c4eebedf210ba10893f19ba05edLennart Poettering * (at your option) any later version.
73090dc815390f4fca4e3ed8a7e1d3806605daaaLennart Poettering * This program is distributed in the hope that it will be useful,
f957632b960a0a42999b38ded7089fa602b41745Kay Sievers * but WITHOUT ANY WARRANTY; without even the implied warranty of
f957632b960a0a42999b38ded7089fa602b41745Kay Sievers * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f957632b960a0a42999b38ded7089fa602b41745Kay Sievers * GNU General Public License for more details.
9a36607584bbd1d78775353e022a51794b4e27b1Lennart Poettering * You should have received a copy of the GNU General Public License
9a36607584bbd1d78775353e022a51794b4e27b1Lennart Poettering * along with this program. If not, see <http://www.gnu.org/licenses/>.
d2e83c23f5f0cdd3b6ec05c5c40209708721e704Kay Sieversvoid udev_main_log(struct udev *udev, int priority,
e707c49485b8f4f2ec040d3da232d39153e650b9Lennart Poettering sigprocmask(SIG_SETMASK, NULL, &sigmask_orig);
a73d88fa024b5668ed7dde681e99547d41e6a864Lennart Poettering util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL);
f2d433e178df7df01a836e95775261e1d85ec60dZbigniew Jędrzejewski-Szmek dev = udev_device_new_from_syspath(udev, syspath);
a19554ed92a7460b4e709cc40c558cde827ab85bLennart Poettering info(udev, "unknown device '%s'\n", devpath);
a19554ed92a7460b4e709cc40c558cde827ab85bLennart Poettering sigprocmask(SIG_SETMASK, &mask, &sigmask_orig);
a19554ed92a7460b4e709cc40c558cde827ab85bLennart Poettering event->fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC);
a19554ed92a7460b4e709cc40c558cde827ab85bLennart Poettering fprintf(stderr, "error creating signalfd\n");
1cb88f2c61f590083847d65cd5a518e834da87d3Lennart Poettering /* do what devtmpfs usually provides us */
1cb88f2c61f590083847d65cd5a518e834da87d3Lennart Poettering if (udev_device_get_devnode(dev) != NULL) {
1cb88f2c61f590083847d65cd5a518e834da87d3Lennart Poettering if (strcmp(udev_device_get_subsystem(dev), "block") == 0)
936d6fcb6c4fc8839d28f8585af6ba733a7e1a1aLennart Poettering util_create_path(udev, udev_device_get_devnode(dev));
936d6fcb6c4fc8839d28f8585af6ba733a7e1a1aLennart Poettering mknod(udev_device_get_devnode(dev), mode, udev_device_get_devnum(dev));
ea117d4fde8b8d0b52f9d32ebd4bc09a5bd2ca8bLennart Poettering util_delete_path(udev, udev_device_get_devnode(dev));
6d0274f11547a0f11200bb82bf598a5a253e12cfLennart Poettering err = udev_event_execute_rules(event, rules, &sigmask_orig);
9a526a06bd22ccaf6641d11323fb04a0512a0e49Lennart Poettering if (event != NULL && event->fd_signal >= 0)