Deleted Added
full compact
rc.subr (291770) rc.subr (295949)
1# $NetBSD: rc.subr,v 1.67 2006/10/07 11:25:15 elad Exp $
1# $NetBSD: rc.subr,v 1.67 2006/10/07 11:25:15 elad Exp $
2# $FreeBSD: head/etc/rc.subr 291770 2015-12-04 16:32:29Z jilles $
2# $FreeBSD: head/etc/rc.subr 295949 2016-02-24 01:32:12Z araujo $
3#
4# Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
5# All rights reserved.
6#
7# This code is derived from software contributed to The NetBSD Foundation
8# by Luke Mewburn.
9#
10# Redistribution and use in source and binary forms, with or without

--- 29 unchanged lines hidden (view full) ---

40
41if [ -z "${_rc_subr_loaded}" ]; then
42
43_rc_subr_loaded="YES"
44
45SYSCTL="/sbin/sysctl"
46SYSCTL_N="${SYSCTL} -n"
47SYSCTL_W="${SYSCTL}"
3#
4# Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
5# All rights reserved.
6#
7# This code is derived from software contributed to The NetBSD Foundation
8# by Luke Mewburn.
9#
10# Redistribution and use in source and binary forms, with or without

--- 29 unchanged lines hidden (view full) ---

40
41if [ -z "${_rc_subr_loaded}" ]; then
42
43_rc_subr_loaded="YES"
44
45SYSCTL="/sbin/sysctl"
46SYSCTL_N="${SYSCTL} -n"
47SYSCTL_W="${SYSCTL}"
48PROTECT="/usr/bin/protect"
48ID="/usr/bin/id"
49IDCMD="if [ -x $ID ]; then $ID -un; fi"
50PS="/bin/ps -ww"
51JID=`$PS -p $$ -o jid=`
52
53#
54# functions
55# ---------

--- 694 unchanged lines hidden (view full) ---

750# can be used to override this.
751#
752# ${name}_env n Environment variables to run ${command} with.
753#
754# ${name}_fib n Routing table number to run ${command} with.
755#
756# ${name}_nice n Nice level to run ${command} at.
757#
49ID="/usr/bin/id"
50IDCMD="if [ -x $ID ]; then $ID -un; fi"
51PS="/bin/ps -ww"
52JID=`$PS -p $$ -o jid=`
53
54#
55# functions
56# ---------

--- 694 unchanged lines hidden (view full) ---

751# can be used to override this.
752#
753# ${name}_env n Environment variables to run ${command} with.
754#
755# ${name}_fib n Routing table number to run ${command} with.
756#
757# ${name}_nice n Nice level to run ${command} at.
758#
759# ${name}_oomprotect n Don't kill ${command} when swap space is exhausted.
760#
758# ${name}_user n User to run ${command} as, using su(1) if not
759# using ${name}_chroot.
760# Requires /usr to be mounted.
761#
762# ${name}_group n Group to run chrooted ${command} as.
763# Requires /usr to be mounted.
764#
765# ${name}_groups n Comma separated list of supplementary groups

--- 173 unchanged lines hidden (view full) ---

939 rc_flags=$flags
940 else
941 eval rc_flags=\$${name}_flags
942 fi
943 eval _chdir=\$${name}_chdir _chroot=\$${name}_chroot \
944 _nice=\$${name}_nice _user=\$${name}_user \
945 _group=\$${name}_group _groups=\$${name}_groups \
946 _fib=\$${name}_fib _env=\$${name}_env \
761# ${name}_user n User to run ${command} as, using su(1) if not
762# using ${name}_chroot.
763# Requires /usr to be mounted.
764#
765# ${name}_group n Group to run chrooted ${command} as.
766# Requires /usr to be mounted.
767#
768# ${name}_groups n Comma separated list of supplementary groups

--- 173 unchanged lines hidden (view full) ---

942 rc_flags=$flags
943 else
944 eval rc_flags=\$${name}_flags
945 fi
946 eval _chdir=\$${name}_chdir _chroot=\$${name}_chroot \
947 _nice=\$${name}_nice _user=\$${name}_user \
948 _group=\$${name}_group _groups=\$${name}_groups \
949 _fib=\$${name}_fib _env=\$${name}_env \
947 _prepend=\$${name}_prepend _login_class=\${${name}_login_class:-daemon}
950 _prepend=\$${name}_prepend _login_class=\${${name}_login_class:-daemon} \
951 _oomprotect=\$${name}_oomprotect
948
949 if [ -n "$_user" ]; then # unset $_user if running as that user
950 if [ "$_user" = "$(eval $IDCMD)" ]; then
951 unset _user
952 fi
953 fi
954
955 [ -z "$autoboot" ] && eval $_pidcmd # determine the pid if necessary

--- 221 unchanged lines hidden (view full) ---

1177 echo ""
1178 ;;
1179
1180 *)
1181 rc_usage $_keywords
1182 ;;
1183
1184 esac
952
953 if [ -n "$_user" ]; then # unset $_user if running as that user
954 if [ "$_user" = "$(eval $IDCMD)" ]; then
955 unset _user
956 fi
957 fi
958
959 [ -z "$autoboot" ] && eval $_pidcmd # determine the pid if necessary

--- 221 unchanged lines hidden (view full) ---

1181 echo ""
1182 ;;
1183
1184 *)
1185 rc_usage $_keywords
1186 ;;
1187
1188 esac
1189
1190 # Apply protect(1) to the PID if ${name}_oomprotect is set.
1191 case "$rc_arg" in
1192 start)
1193 if [ -n "$_oomprotect" ]; then
1194 if [ -f "${PROTECT}" ]; then
1195 pid=$(check_process $command)
1196 case $_oomprotect in
1197 [Aa][Ll][Ll])
1198 ${PROTECT} -i -p ${pid}
1199 ;;
1200 [Yy][Ee][Ss])
1201 ${PROTECT} -p ${pid}
1202 ;;
1203 esac
1204 fi
1205 fi
1206 ;;
1207 esac
1208
1185 return $_return
1186 done
1187
1188 echo 1>&2 "$0: unknown directive '$rc_arg'."
1189 rc_usage $_keywords
1190 # not reached
1191}
1192

--- 908 unchanged lines hidden ---
1209 return $_return
1210 done
1211
1212 echo 1>&2 "$0: unknown directive '$rc_arg'."
1213 rc_usage $_keywords
1214 # not reached
1215}
1216

--- 908 unchanged lines hidden ---