Imported Upstream version 1.7.0
[platform/upstream/augeas.git] / lenses / limits.aug
1 (* Limits module for Augeas
2  Author: Free Ekanayaka <free@64studio.com>
3
4  Reference: /etc/security/limits.conf
5
6 *)
7
8 module Limits =
9
10    autoload xfm
11
12 (************************************************************************
13  *                           USEFUL PRIMITIVES
14  *************************************************************************)
15
16 let eol        = Util.eol
17 let comment_or_eol = Util.comment_or_eol
18 let spc        = Util.del_ws_spc
19 let comment    = Util.comment
20 let empty      = Util.empty
21
22 let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/
23
24 (************************************************************************
25  *                               ENTRIES
26  *************************************************************************)
27
28 let domain     = label "domain" . store /[%@]?[A-Za-z0-9_.-]+|\*/
29
30 let type_re    = "soft"
31                | "hard"
32                | "-"
33 let type       = [ label "type" . store type_re ]
34
35 let item_re    = "core"
36                | "data"
37                | "fsize"
38                | "memlock"
39                | "nofile"
40                | "rss"
41                | "stack"
42                | "cpu"
43                | "nproc"
44                | "as"
45                | "maxlogins"
46                | "maxsyslogins"
47                | "priority"
48                | "locks"
49                | "sigpending"
50                | "msgqueue"
51                | "nice"
52                | "rtprio"
53                | "chroot"
54 let item       = [ label "item" . store item_re ]
55
56 let value      = [ label "value" . store /[A-Za-z0-9_.\/-]+/ ]
57 let entry      = [ domain . spc
58                  . type   . spc
59                  . item   . spc
60                  . value  . comment_or_eol ]
61
62 (************************************************************************
63  *                                LENS
64  *************************************************************************)
65
66 let lns        = (comment|empty|entry) *
67
68 let filter     = incl "/etc/security/limits.conf"
69                . incl "/etc/security/limits.d/*.conf"
70
71 let xfm        = transform lns filter