| 1920 | } |
| 1921 | |
| 1922 | int |
| 1923 | sys_rctl_remove_rule(struct thread *td, struct rctl_remove_rule_args *uap) |
| 1924 | { |
| 1925 | struct rctl_rule *filter; |
| 1926 | char *inputstr; |
| 1927 | int error; |
| 1928 | |
| 1929 | if (!racct_enable) |
| 1930 | return (ENOSYS); |
| 1931 | |
| 1932 | error = priv_check(td, PRIV_RCTL_REMOVE_RULE); |
| 1933 | if (error != 0) |
| 1934 | return (error); |
| 1935 | |
| 1936 | error = rctl_read_inbuf(&inputstr, uap->inbufp, uap->inbuflen); |
| 1937 | if (error != 0) |
| 1938 | return (error); |
| 1939 | |
| 1940 | sx_slock(&allproc_lock); |
| 1941 | error = rctl_string_to_rule(inputstr, &filter); |
| 1942 | free(inputstr, M_RCTL); |
| 1943 | if (error != 0) { |
| 1944 | sx_sunlock(&allproc_lock); |
| 1945 | return (error); |
| 1946 | } |
| 1947 | |
| 1948 | error = rctl_rule_remove(filter); |
| 1949 | rctl_rule_release(filter); |
| 1950 | sx_sunlock(&allproc_lock); |
| 1951 | |
| 1952 | return (error); |
| 1953 | } |
| 1954 | |
| 1955 | /* |
| 1956 | * Update RCTL rule list after credential change. |
nothing calls this directly
no test coverage detected