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

« back to all changes in this revision

Viewing changes to tests/regression/subdomain/syscall_query_module.c

  • 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
 
 
3
 
/*
4
 
 *      Copyright (C) 2002-2005 Novell/SUSE
5
 
 *
6
 
 *      This program is free software; you can redistribute it and/or
7
 
 *      modify it under the terms of the GNU General Public License as
8
 
 *      published by the Free Software Foundation, version 2 of the
9
 
 *      License.
10
 
 */
11
 
 * $Id: syscall_query_module.c 61 2006-05-19 18:32:14Z steve-beattie $
12
 
 */
13
 
 
14
 
#include <stdio.h>
15
 
#include <unistd.h>
16
 
#include <errno.h>
17
 
#include <sys/types.h>
18
 
#include <linux/module.h>
19
 
 
20
 
#define BUFSIZE 4096
21
 
int main(int argc, char *argv[])
22
 
{
23
 
        char buffer[BUFSIZE];
24
 
        size_t ret = 0;
25
 
        struct module_info modinfo;
26
 
        
27
 
        if (argc > 2) {
28
 
                fprintf(stderr, "Usage: %s [module]\n",
29
 
                        argv[0]);
30
 
                return 1;
31
 
        } else if (argc == 1) {
32
 
                if (query_module(NULL, QM_MODULES, &buffer, BUFSIZE,
33
 
                                &ret) == -1) {
34
 
                        fprintf(stderr, "FAIL: query_module failed - %s\n",
35
 
                                strerror(errno));
36
 
                        return 1;
37
 
                }
38
 
                /* printf ("First module: %s\n", buffer); */
39
 
        } else {
40
 
                if (query_module(argv[1], QM_INFO, &modinfo, sizeof(modinfo),
41
 
                                &ret) == -1) {
42
 
                        fprintf(stderr, "FAIL: query_module failed - %s\n",
43
 
                                strerror(errno));
44
 
                        return 1;
45
 
                }
46
 
                /* printf ("module %s info: address 0x%8x size %u flags 0x%8x "
47
 
                                "usecount %d\n", 
48
 
                                argv[1],
49
 
                                modinfo.addr,
50
 
                                modinfo.size,
51
 
                                modinfo.flags,
52
 
                                modinfo.usecount); */
53
 
        }
54
 
 
55
 
        /* printf("Kernel release version is %s\n", release); */
56
 
        printf("PASS\n");
57
 
 
58
 
        return 0;
59
 
}