~apparmor-dev/apparmor/master

« back to all changes in this revision

Viewing changes to tests/regression/apparmor/syscall_setpriority.c

  • Committer: Steve Beattie
  • Date: 2019-02-19 09:38:13 UTC
  • Revision ID: sbeattie@ubuntu.com-20190219093813-ud526ee6hwn8nljz
The AppArmor project has been converted to git and is now hosted on
gitlab.

To get the converted repository, please do
  git clone https://gitlab.com/apparmor/apparmor

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *      Copyright (C) 2002-2005 Novell/SUSE
3
 
 *
4
 
 *      This program is free software; you can redistribute it and/or
5
 
 *      modify it under the terms of the GNU General Public License as
6
 
 *      published by the Free Software Foundation, version 2 of the
7
 
 *      License.
8
 
 */
9
 
 
10
 
#include <unistd.h>
11
 
#include <stdlib.h>
12
 
#include <stdio.h>
13
 
#include <errno.h>
14
 
#include <sys/time.h>
15
 
#include <sys/resource.h>
16
 
 
17
 
 
18
 
int
19
 
main (int argc, char * argv[]) {
20
 
        int rc;
21
 
        int niceval;
22
 
 
23
 
        if (argc == 2) {
24
 
                niceval = strtol (argv[1], NULL, 10);
25
 
        } else {
26
 
                niceval = -5;
27
 
        }
28
 
        
29
 
        rc = setpriority(PRIO_PROCESS, 0, niceval);
30
 
        if (rc != 0) {
31
 
                perror ("FAIL: setpriority failed");
32
 
                return errno;
33
 
        }
34
 
 
35
 
        printf ("PASS\n");
36
 
 
37
 
        return 0;
38
 
}
39