bus-track.c revision 33c62dcbd78dd42603a0d8989a150e816e0414d9
/*-*- 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 "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 (!bus->bus_client)
return -EINVAL;
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)
log_debug_errno(r, "Failed to process track handler: %m");
else if (r == 0)
}
}
void *ret;
return ret;
}