1*55648840SJohn Baldwin.\" Copyright (c) 2013 Advanced Computing Technologies LLC 2*55648840SJohn Baldwin.\" Written by: John H. Baldwin <jhb@FreeBSD.org> 3*55648840SJohn Baldwin.\" All rights reserved. 4*55648840SJohn Baldwin.\" 5*55648840SJohn Baldwin.\" Redistribution and use in source and binary forms, with or without 6*55648840SJohn Baldwin.\" modification, are permitted provided that the following conditions 7*55648840SJohn Baldwin.\" are met: 8*55648840SJohn Baldwin.\" 1. Redistributions of source code must retain the above copyright 9*55648840SJohn Baldwin.\" notice, this list of conditions and the following disclaimer. 10*55648840SJohn Baldwin.\" 2. Redistributions in binary form must reproduce the above copyright 11*55648840SJohn Baldwin.\" notice, this list of conditions and the following disclaimer in the 12*55648840SJohn Baldwin.\" documentation and/or other materials provided with the distribution. 13*55648840SJohn Baldwin.\" 14*55648840SJohn Baldwin.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15*55648840SJohn Baldwin.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16*55648840SJohn Baldwin.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17*55648840SJohn Baldwin.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18*55648840SJohn Baldwin.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19*55648840SJohn Baldwin.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20*55648840SJohn Baldwin.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21*55648840SJohn Baldwin.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22*55648840SJohn Baldwin.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23*55648840SJohn Baldwin.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24*55648840SJohn Baldwin.\" SUCH DAMAGE. 25*55648840SJohn Baldwin.\" 26*55648840SJohn Baldwin.\" $FreeBSD$ 27*55648840SJohn Baldwin.\" 28*55648840SJohn Baldwin.Dd September 19, 2013 29*55648840SJohn Baldwin.Dt PROTECT 1 30*55648840SJohn Baldwin.Os 31*55648840SJohn Baldwin.Sh NAME 32*55648840SJohn Baldwin.Nm protect 33*55648840SJohn Baldwin.Nd "protect processes from being killed when swap space is exhausted" 34*55648840SJohn Baldwin.Sh SYNOPSIS 35*55648840SJohn Baldwin.Nm 36*55648840SJohn Baldwin.Op Fl i 37*55648840SJohn Baldwin.Ar command 38*55648840SJohn Baldwin.Nm 39*55648840SJohn Baldwin.Op Fl cdi 40*55648840SJohn Baldwin.Fl g Ar pgrp | Fl p Ar pid 41*55648840SJohn Baldwin.Sh DESCRIPTION 42*55648840SJohn BaldwinThe 43*55648840SJohn Baldwin.Nm 44*55648840SJohn Baldwincommand is used to mark processes as protected. 45*55648840SJohn BaldwinThe kernel does not kill protected processes when swap space is exhausted. 46*55648840SJohn BaldwinNote that this protected state is not inherited by child processes by default. 47*55648840SJohn Baldwin.Pp 48*55648840SJohn BaldwinThe options are: 49*55648840SJohn Baldwin.Bl -tag -width indent 50*55648840SJohn Baldwin.It Fl c 51*55648840SJohn BaldwinRemove protection from the specified processes. 52*55648840SJohn Baldwin.It Fl d 53*55648840SJohn BaldwinApply the operation to all current children of the specified processes. 54*55648840SJohn Baldwin.It Fl i 55*55648840SJohn BaldwinApply the operation to all future children of the specified processes. 56*55648840SJohn Baldwin.It Fl g Ar pgrp 57*55648840SJohn BaldwinApply the operation to all processes in the specified process group. 58*55648840SJohn Baldwin.It Fl p Ar pid 59*55648840SJohn BaldwinApply the operation to the specified process. 60*55648840SJohn Baldwin.It Ar command 61*55648840SJohn BaldwinExecute 62*55648840SJohn Baldwin.Ar command 63*55648840SJohn Baldwinas a protected process. 64*55648840SJohn Baldwin.El 65*55648840SJohn Baldwin.Pp 66*55648840SJohn BaldwinNote that only one of the 67*55648840SJohn Baldwin.Fl p 68*55648840SJohn Baldwinor 69*55648840SJohn Baldwin.Fl g 70*55648840SJohn Baldwinflags may be specified when adjusting the state of existing processes. 71*55648840SJohn Baldwin.Sh EXIT STATUS 72*55648840SJohn Baldwin.Ex -std 73*55648840SJohn Baldwin.Sh EXAMPLES 74*55648840SJohn BaldwinMark the Xorg server as protected: 75*55648840SJohn Baldwin.Pp 76*55648840SJohn Baldwin.Dl "pgrep Xorg | xargs protect -p" 77*55648840SJohn BaldwinProtect all ssh sessions and their child processes: 78*55648840SJohn Baldwin.Pp 79*55648840SJohn Baldwin.Dl "pgrep sshd | xargs protect -dip" 80*55648840SJohn BaldwinRemove protection from all current and future processes: 81*55648840SJohn Baldwin.Pp 82*55648840SJohn Baldwin.Dl "protect -cdi -p 1" 83*55648840SJohn Baldwin.Sh SEE ALSO 84*55648840SJohn Baldwin.Xr pprotect 2 85*55648840SJohn Baldwin.Sh BUGS 86*55648840SJohn BaldwinIf you protect a runaway process that allocates all memory the system will 87*55648840SJohn Baldwindeadlock. 88*55648840SJohn Baldwin.Pp 89*55648840SJohn BaldwinInheritance of the protected state is not yet implemented. 90