#include <unistd.h>
#include <syslog.h>
+#define LOGNAME_SIZE 42
+
#undef info
#define info(format, arg...) \
do { \
__attribute__ ((format (printf, 2, 3)));
/* each program that uses syslog must declare this variable somewhere */
-extern unsigned char logname[42];
+extern unsigned char logname[LOGNAME_SIZE];
#undef init_logging
static inline void init_logging(char *program_name)
{
- snprintf(logname, 42,"%s[%d]", program_name, getpid());
+ snprintf(logname, LOGNAME_SIZE,"%s[%d]", program_name, getpid());
openlog(logname, 0, LOG_DAEMON);
}
void dump_config_dev(struct config_device *dev)
{
- /*FIXME dump all sysfs's */
dbg_parse("name='%s', symlink='%s', bus='%s', place='%s', id='%s', "
"sysfs_file[0]='%s', sysfs_value[0]='%s', "
"kernel='%s', program='%s', result='%s'",
char **main_envp;
#ifdef LOG
-unsigned char logname[42];
+unsigned char logname[LOGNAME_SIZE];
void log_message(int level, const char *format, ...)
{
va_list args;
"usb_host",
"pci_bus",
"pcmcia_socket",
- "",
+ ""
};
static int udev_hotplug(void)
return -retval;
}
-int main(int argc, char **argv, char **envp)
+int main(int argc, char *argv[], char *envp[])
{
main_argv = argv;
main_envp = envp;
static void msg_queue_manager(void);
#ifdef LOG
-unsigned char logname[42];
+unsigned char logname[LOGNAME_SIZE];
void log_message (int level, const char *format, ...)
{
va_list args;
int main_argc;
#ifdef LOG
-unsigned char logname[42];
+unsigned char logname[LOGNAME_SIZE];
void log_message (int level, const char *format, ...)
{
va_list args;
#include "logging.h"
#ifdef LOG
-unsigned char logname[42];
+unsigned char logname[LOGNAME_SIZE];
void log_message (int level, const char *format, ...)
{
va_list args;
#ifdef LOG
-unsigned char logname[42];
+unsigned char logname[LOGNAME_SIZE];
void log_message(int level, const char *format, ...)
{
va_list args;
}
-int main(int argc, char **argv, char **envp)
+int main(int argc, char *argv[], char *envp[])
{
init_logging("udevstart");
char **main_envp;
#ifdef LOG
-unsigned char logname[42];
+unsigned char logname[LOGNAME_SIZE];
void log_message (int level, const char *format, ...)
{
- va_list args;
+ va_list args;
-// if (!udev_log)
-// return;
-
- /* FIXME use level... */
va_start(args, format);
vprintf(format, args);
va_end(args);
}
#endif
-static void sig_handler(int signum)
-{
- switch (signum) {
- case SIGINT:
- case SIGTERM:
- exit(20 + signum);
- default:
- dbg("unhandled signal");
- }
-}
-
static char *subsystem_blacklist[] = {
"net",
"scsi_host",
"scsi_device",
"usb_host",
"pci_bus",
- "",
+ "pcmcia_socket",
+ ""
};
-static int udev_hotplug(int argc, char **argv)
+static int udev_hotplug(void)
{
char *devpath;
char *subsystem;
int retval = -EINVAL;
int i;
- struct sigaction act;
- devpath = argv[1];
+ devpath = main_argv[1];
if (!devpath) {
dbg("no devpath?");
goto exit;
}
/* skip blacklisted subsystems */
- subsystem = argv[1];
+ subsystem = main_argv[1];
i = 0;
while (subsystem_blacklist[i][0] != '\0') {
if (strcmp(subsystem, subsystem_blacklist[i]) == 0) {
/* initialize our configuration */
udev_init_config();
- /* set up a default signal handler for now */
- act.sa_handler = sig_handler;
- sigemptyset (&act.sa_mask);
- act.sa_flags = SA_RESTART;
- sigaction(SIGINT, &act, NULL);
- sigaction(SIGTERM, &act, NULL);
-
/* initialize the naming deamon */
namedev_init();
+ /* simulate node creation with fake flag */
retval = udev_add_device(devpath, subsystem, 1);
exit:
return -retval;
}
-int main(int argc, char **argv, char **envp)
+int main(int argc, char *argv[], char *envp[])
{
main_argv = argv;
main_envp = envp;
dbg("version %s", UDEV_VERSION);
- return udev_hotplug(argc, argv);
+ return udev_hotplug();
}