test-udev.c revision 726687ad48bdececed1e7e44387c50e009e28208
/*
* Copyright (C) 2003-2004 Greg Kroah-Hartman <greg@kroah.com>
* Copyright (C) 2004-2006 Kay Sievers <kay.sievers@vrfy.org>
*
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <ctype.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#include <syslog.h>
#include "udev.h"
#include "udev_rules.h"
#include "udev_selinux.h"
#ifdef USE_LOG
{
if (priority > udev_log_priority)
return;
}
#endif
{
switch (signum) {
case SIGALRM:
exit(1);
case SIGINT:
case SIGTERM:
}
}
{
struct sysfs_device *dev;
struct udev_rules rules;
const char *action;
const char *devpath;
const char *subsystem;
int devnull;
exit(0);
}
if (devnull >= 0) {
if (devnull != STDIN_FILENO)
if (devnull != STDOUT_FILENO)
if (devnull != STDERR_FILENO)
if (devnull > STDERR_FILENO)
}
logging_init("udev");
if (devnull < 0)
selinux_init();
/* set signal handlers */
/* trigger timeout to prevent hanging processes */
/* older kernels passed the SUBSYSTEM only as argument */
err("action, subsystem or devpath missing\n");
goto exit;
}
/* export log_priority , as called programs may want to do the same as udev */
if (udev_log_priority) {
char priority[32];
}
sysfs_init();
udev_rules_init(&rules, 0);
goto fail;
}
goto fail;
/* override built-in sysfs device */
/* get dev_t from environment, which is needed for "remove" to work, "add" works also from sysfs */
else
if (udev->event_timeout >= 0)
fail:
selinux_exit();
exit:
if (retval != 0)
return 1;
return 0;
}