udev-ctrl.c revision 4bbdff757ed4e718a3348b93439a03055cc5e3bc
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * libudev - interface to udev device information
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * Copyright (C) 2008 Kay Sievers <kay@vrfy.org>
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * This library is free software; you can redistribute it and/or
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * modify it under the terms of the GNU Lesser General Public
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * License as published by the Free Software Foundation; either
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * version 2.1 of the License, or (at your option) any later version.
3c0cf502796be355431d4a64d738e75f543aa51dLennart Poettering/* wire protocol magic must match */
struct udev_ctrl_connection {
int refcount;
int sock;
return NULL;
if (fd < 0) {
return NULL;
return uctrl;
int err;
if (err < 0) {
return err;
if (err < 0) {
return err;
return NULL;
return uctrl;
return NULL;
return uctrl;
return NULL;
return -EINVAL;
return NULL;
goto err;
goto err;
goto err;
return conn;
err:
return NULL;
return NULL;
return conn;
return NULL;
return conn;
return NULL;
static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf, int timeout) {
int err = 0;
goto out;
goto out;
out:
return err;
return NULL;
goto err;
goto err;
goto err;
if (size < 0) {
goto err;
goto err;
goto err;
goto err;
return uctrl_msg;
err:
return NULL;
return NULL;
return ctrl_msg;
return NULL;
return NULL;