udevcontrol.c revision 2b725651e5b77e88a314d34b8cf8e375514b400f
/*
* Copyright (C) 2005-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 "config.h"
#include <time.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>
#include "udev.h"
#include "udevd.h"
static int udev_log = 0;
struct udev_ctrl;
struct udev_ctrl {
int sock;
struct sockaddr_un saddr;
};
{
return NULL;
return NULL;
}
/* translate leading '@' to abstract namespace */
return uctrl;
}
{
return;
}
static int ctrl_send(struct udev_ctrl *uctrl, enum udevd_ctrl_msg_type type, int intval, const char *buf)
{
struct udevd_ctrl_msg ctrl_msg;
int err;
else
err = sendto(uctrl->sock, &ctrl_msg, sizeof(ctrl_msg), 0, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen);
if (err == -1) {
}
return err;
}
{
return 0;
}
{
return 0;
}
{
return 0;
}
{
return 0;
}
{
return 0;
}
{
return 0;
}
{
return 0;
}
{
const char *env;
int rc = 1;
/* compat values with '_' will be removed in a future release */
{}
};
if (env)
logging_init("udevcontrol");
if (getuid() != 0) {
goto exit;
}
goto exit;
while (1) {
int option;
int i;
char *endp;
if (option == -1)
break;
if (option > 255) {
info("udevadm control expects commands without underscore, "
"this will stop working in a future release\n");
"this will stop working in a future release\n");
}
switch (option) {
case 'l':
case 'l' + 256:
i = log_priority(optarg);
if (i < 0) {
goto exit;
}
break;
case 's':
case 's' + 256:
break;
case 'S':
case 'S' + 256:
break;
case 'R':
case 'R' + 256:
break;
case 'e':
goto exit;
}
break;
case 'm':
case 'm' + 256:
goto exit;
}
break;
case 'M':
case 'M' + 256:
goto exit;
}
break;
break;
case 'h':
printf("Usage: udevadm control COMMAND\n"
" --log-priority=<level> 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"
" --env=<KEY>=<value> set a global environment variable\n"
" --max-childs=<N> maximum number of childs\n"
" --max-childs-running=<N> maximum number of childs running at the same time\n"
" --help print this help text\n\n");
goto exit;
default:
goto exit;
}
}
/* compat stuff which will be removed in a future release */
"this will stop working in a future release\n");
err("udevadm control commands requires the --<command> format, "
"this will stop working in a future release\n");
} else {
}
}
exit:
return rc;
}