libudev-ctrl.c revision 48a9b173e88738ff4eefb3519f1d27711b417c8d
/*
* libudev - interface to udev device information
*
* Copyright (C) 2008 Kay Sievers <kay.sievers@vrfy.org>
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <unistd.h>
#include "libudev.h"
#include "libudev-private.h"
/* wire protocol magic must match */
#define UDEV_CTRL_MAGIC 0xdead1dea
enum udev_ctrl_msg_type {
};
struct udev_ctrl_msg_wire {
char version[16];
unsigned int magic;
enum udev_ctrl_msg_type type;
union {
int intval;
char buf[256];
};
};
struct udev_ctrl_msg {
int refcount;
struct udev_ctrl_msg_wire ctrl_msg_wire;
};
struct udev_ctrl {
int refcount;
int sock;
struct sockaddr_un saddr;
};
{
return NULL;
return NULL;
}
/* translate leading '@' to abstract namespace */
return uctrl;
}
{
int err;
const int feature_on = 1;
if (err < 0) {
return err;
}
/* enable receiving of the sender credentials */
return 0;
}
{
}
{
return NULL;
return uctrl;
}
{
return;
return;
}
{
return -1;
}
static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf)
{
struct udev_ctrl_msg_wire ctrl_msg_wire;
int err;
else
if (err == -1) {
}
return err;
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
struct udev_ctrl_msg *uctrl_msg;
return NULL;
if (size < 0) {
goto err;
}
goto err;
}
goto err;
}
err(uctrl->udev, "message magic 0x%08x doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic);
goto err;
}
return uctrl_msg;
err:
return NULL;
}
{
return NULL;
return ctrl_msg;
}
{
return;
return;
}
{
return -1;
}
{
return 1;
return -1;
}
{
return 1;
return -1;
}
{
return 1;
return -1;
}
{
return NULL;
}
{
return -1;
}
{
return -1;
}