~ubuntu-branches/ubuntu/wily/apparmor/wily

« back to all changes in this revision

Viewing changes to libraries/libapparmor/src/apparmor.h

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2011-04-27 10:38:07 UTC
  • mfrom: (5.1.118 natty)
  • Revision ID: james.westby@ubuntu.com-20110427103807-ym3rhwys6o84ith0
Tags: 2.6.1-2
debian/copyright: clarify for some full organization names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2003-2008 Novell, Inc. (All rights reserved)
 
3
 * Copyright 2009-2010 Canonical Ltd.
 
4
 *
 
5
 * The libapparmor library is licensed under the terms of the GNU
 
6
 * Lesser General Public License, version 2.1. Please see the file
 
7
 * COPYING.LGPL.
 
8
 *
 
9
 * This library is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU Lesser General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU Lesser General Public License
 
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
16
 */
 
17
 
 
18
#ifndef _SYS_APPARMOR_H_
 
19
#define _SYS_APPARMOR_H 1
 
20
 
 
21
__BEGIN_DECLS
 
22
 
 
23
/* Prototypes for self directed domain transitions
 
24
 * see <http://apparmor.net>
 
25
 * Please see the change_hat(2) manpage for information.
 
26
 */
 
27
 
 
28
#define change_hat(X, Y) aa_change_hat((X), (Y))
 
29
extern int (change_hat)(const char *subprofile, unsigned int magic_token);
 
30
extern int aa_change_hat(const char *subprofile, unsigned long magic_token);
 
31
extern int aa_change_profile(const char *profile);
 
32
extern int aa_change_onexec(const char *profile);
 
33
 
 
34
extern int aa_change_hatv(const char *subprofiles[], unsigned long token);
 
35
extern int (aa_change_hat_vargs)(unsigned long token, int count, ...);
 
36
 
 
37
#define __macroarg_counter(Y...) __macroarg_count1 ( , ##Y)
 
38
#define __macroarg_count1(Y...) __macroarg_count2 (Y, 16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
 
39
#define __macroarg_count2(_,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,n,Y...) n
 
40
 
 
41
/**
 
42
 * change_hat_vargs - a wrapper macro for change_hat_vargs
 
43
 * @T: the magic token
 
44
 * @X...: the parameter list of hats being passed
 
45
 *
 
46
 * The change_hat_vargs macro makes it so the caller doesn't have to
 
47
 * specify the number of hats passed as parameters to the change_hat_vargs
 
48
 * fn.
 
49
 *
 
50
 * eg.
 
51
 * change_hat_vargs(10, hat1, hat2, hat3, hat4);
 
52
 * expandes to
 
53
 * (change_hat_vargs)(10, 4, hat1, hat2, hat3, hat4);
 
54
 *
 
55
 * to call change_hat_vargs direction do
 
56
 * (change_hat_vargs)(token, nhats, hat1, hat2...)
 
57
 */
 
58
#define aa_change_hat_vargs(T, X...) \
 
59
        (aa_change_hat_vargs)(T, __macroarg_counter(X), X)
 
60
 
 
61
__END_DECLS
 
62
 
 
63
#endif  /* sys/apparmor.h */