udevadm-test.c revision 9ec6e95b046de71c0198cb9d17acc5462dc76c74
/*
* Copyright (C) 2003-2004 Greg Kroah-Hartman <greg@kroah.com>
* Copyright (C) 2004-2008 Kay Sievers <kay@vrfy.org>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stddef.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include <fcntl.h>
#include <signal.h>
#include <syslog.h>
#include <getopt.h>
#include <sys/signalfd.h>
#include "udev.h"
#include "udev-util.h"
int resolve_names = 1;
char filename[UTIL_PATH_SIZE];
const char *action = "add";
struct udev_list_entry *entry;
int rc = 0, c;
{}
};
switch (c) {
case 'a':
break;
case 'N':
resolve_names = 1;
resolve_names = 0;
resolve_names = -1;
} else {
log_error("resolve-names must be early, late or never");
}
break;
case 'h':
printf("Usage: udevadm test OPTIONS <syspath>\n"
" -a,--action=ACTION set action string\n"
" -N,--resolve-names=early|late|never when to resolve names\n"
" -h,--help print this help string\n"
"\n");
case '?':
default:
assert_not_reached("Unknown option");
}
rc = 2;
goto out;
}
printf("This program is for debugging only, it does not run any program\n"
"specified by a RUN key. It may show incorrect results, because\n"
"some values may be different, or not available at a simulation run.\n"
"\n");
rc = 3;
goto out;
}
/* add /sys if needed */
else
rc = 4;
goto out;
}
/* skip reading of db, but read kernel parameters */
sigfillset(&mask);
rc = 5;
goto out;
}
char program[UTIL_PATH_SIZE];
}
out:
return rc;
}
const struct udevadm_cmd udevadm_test = {
.name = "test",
.help = "test an event run",
.debug = true,
};