Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
steam
systemd
Commits
70666185
Commit
70666185
authored
Apr 23, 2013
by
Lennart Poettering
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bus: add cal to determine machine id of an owner of a service
parent
195f8e36
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
src/libsystemd-bus/bus-control.c
src/libsystemd-bus/bus-control.c
+32
-0
src/systemd/sd-bus.h
src/systemd/sd-bus.h
+1
-0
No files found.
src/libsystemd-bus/bus-control.c
View file @
70666185
...
...
@@ -344,3 +344,35 @@ int bus_remove_match_internal(sd_bus *bus, const char *match) {
"s"
,
match
);
}
int
sd_bus_get_owner_machine_id
(
sd_bus
*
bus
,
const
char
*
name
,
sd_id128_t
*
machine
)
{
_cleanup_bus_message_unref_
sd_bus_message
*
reply
=
NULL
;
const
char
*
mid
;
int
r
;
if
(
!
bus
)
return
-
EINVAL
;
if
(
!
name
)
return
-
EINVAL
;
if
(
streq_ptr
(
name
,
bus
->
unique_name
))
return
sd_id128_get_machine
(
machine
);
r
=
sd_bus_call_method
(
bus
,
name
,
"/"
,
"org.freedesktop.DBus.Peer"
,
"GetMachineId"
,
NULL
,
&
reply
,
NULL
);
if
(
r
<
0
)
return
r
;
r
=
sd_bus_message_read
(
reply
,
"s"
,
&
mid
);
if
(
r
<
0
)
return
r
;
return
sd_id128_from_string
(
mid
,
machine
);
}
src/systemd/sd-bus.h
View file @
70666185
...
...
@@ -179,6 +179,7 @@ int sd_bus_list_names(sd_bus *bus, char ***l);
int
sd_bus_get_owner
(
sd_bus
*
bus
,
const
char
*
name
,
char
**
owner
);
int
sd_bus_get_owner_uid
(
sd_bus
*
bus
,
const
char
*
name
,
uid_t
*
uid
);
int
sd_bus_get_owner_pid
(
sd_bus
*
bus
,
const
char
*
name
,
pid_t
*
pid
);
int
sd_bus_get_owner_machine_id
(
sd_bus
*
bus
,
const
char
*
name
,
sd_id128_t
*
machine
);
/* Error structures */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment