2 .TH "BUXTON_SET_LABEL" "3" "buxton 1" "buxton_set_label"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
17 .\" disable justification (adjust text to left margin only)
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
23 buxton_set_label \- Set the Smack label for a group or key
32 int buxton_set_label(BuxtonClient \fIclient\fB,
38 BuxtonCallback \fIcallback\fB,
48 This function is used to set a Smack label, \fIvalue\fR, on a group
49 or key, referred to by \fIkey\fR, on behalf of \fIclient\fR.
51 Note that setting a Smack label is always a privileged operation, so
52 this operation will fail for unprivileged clients\&.
54 Both functions accept optional callback functions to register with
55 the daemon, referenced by the \fIcallback\fR argument; the callback
56 function is called upon completion of the operation\&. The \fIdata\fR
57 argument is a pointer to arbitrary userdata that is passed along to
58 the callback function\&. Additonally, the \fIsync\fR argument
59 controls whether the operation should be synchronous or not; if
60 \fIsync\fR is false, the operation is asynchronous\&.
73 void set_label_cb(BuxtonResponse response, void *data)
78 if (buxton_response_status(response) != 0) {
79 printf("Failed to set label\\n");
83 key = buxton_response_key(response);
84 name = buxton_key_get_name(key);
85 printf("Set label for key %s\\n", name);
97 char* label = "label-test";
99 if ((fd = buxton_open(&client)) < 0) {
100 printf("couldn't connect\\n");
104 key = buxton_key_create("hello", "test", "user", INT32);
109 if (buxton_set_label(client, key, label, set_label_cb,
111 printf("set label call failed to run\\n");
116 pfd[0].events = POLLIN;
118 r = poll(pfd, 1, 5000);
121 printf("poll error\\n");
125 if (!buxton_client_handle_response(client)) {
126 printf("bad response from daemon\\n");
130 buxton_key_free(key);
131 buxton_close(client);
138 Returns 0 on success, and a non\-zero value on failure\&.
142 Copyright 2014 Intel Corporation\&. License: Creative Commons
143 Attribution\-ShareAlike 3.0 Unported\s-2\u[1]\d\s+2, with exception
144 for code examples found in the \fBCODE EXAMPLE\fR section, which are
145 licensed under the MIT license provided in the \fIdocs/LICENSE.MIT\fR
146 file from this buxton distribution\&.
156 Creative Commons Attribution\-ShareAlike 3.0 Unported
158 \%http://creativecommons.org/licenses/by-sa/3.0/