bus-track.c revision 19befb2d5fc087f96e40ddc432b2cc9385666209
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2013 Lennart Poettering
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.
systemd 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "sd-bus.h"
#include "set.h"
#include "bus-util.h"
#include "bus-internal.h"
#include "bus-track.h"
struct sd_bus_track {
unsigned n_ref;
void *userdata;
bool in_queue;
bool modified;
};
#define MATCH_PREFIX \
"type='signal'," \
"sender='org.freedesktop.DBus'," \
"path='/org/freedesktop/DBus'," \
"interface='org.freedesktop.DBus'," \
"member='NameOwnerChanged'," \
"arg0='"
#define MATCH_SUFFIX \
"'"
#define MATCH_FOR_NAME(name) \
({ \
char *_x; \
_x; \
})
return;
return;
}
return;
}
_public_ int sd_bus_track_new(
void *userdata) {
sd_bus_track *t;
if (!t)
return -ENOMEM;
t->n_ref = 1;
*track = t;
return 0;
}
return track;
}
const char *n;
if (!track)
return NULL;
return NULL;
}
return NULL;
}
static int on_name_owner_changed(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
int r;
if (r < 0)
return 0;
return 0;
}
_cleanup_free_ char *n = NULL;
const char *match;
int r;
if (r < 0)
return r;
if (!n)
return -ENOMEM;
/* First, subscribe to this name */
match = MATCH_FOR_NAME(n);
if (r < 0)
return r;
if (r == -EEXIST)
return 0;
if (r < 0)
return r;
/* Second, check if it is currently existing, or maybe
* doesn't, or maybe disappeared already. */
if (r < 0) {
return r;
}
n = NULL;
return 1;
}
_cleanup_free_ char *n = NULL;
if (!track)
return 0;
if (!slot)
return 0;
return 1;
}
if (!track)
return 0;
}
}
const char *n = NULL;
if (!track)
return NULL;
return n;
}
const char *n = NULL;
if (!track)
return NULL;
return NULL;
return n;
}
const char *sender;
assert_return(m, -EINVAL);
if (!sender)
return -EINVAL;
}
const char *sender;
assert_return(m, -EINVAL);
if (!sender)
return -EINVAL;
}
}
int r;
if (r < 0)
else if (r == 0)
}
}
void *ret;
return ret;
}