rc.subr (157656) | rc.subr (157657) |
---|---|
1# $NetBSD: rc.subr,v 1.65 2004/10/12 14:45:29 lukem Exp $ | 1# $NetBSD: rc.subr,v 1.65 2004/10/12 14:45:29 lukem Exp $ |
2# $FreeBSD: head/etc/rc.subr 157656 2006-04-11 09:14:51Z flz $ | 2# $FreeBSD: head/etc/rc.subr 157657 2006-04-11 09:20:47Z flz $ |
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 --- 38 unchanged lines hidden (view full) --- 49 50_rc_subr_loaded="YES" 51 52SYSCTL="/sbin/sysctl" 53SYSCTL_N="${SYSCTL} -n" 54CMD_OSTYPE="${SYSCTL_N} kern.ostype" 55OSTYPE=`${CMD_OSTYPE}` 56ID="/usr/bin/id" | 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 --- 38 unchanged lines hidden (view full) --- 49 50_rc_subr_loaded="YES" 51 52SYSCTL="/sbin/sysctl" 53SYSCTL_N="${SYSCTL} -n" 54CMD_OSTYPE="${SYSCTL_N} kern.ostype" 55OSTYPE=`${CMD_OSTYPE}` 56ID="/usr/bin/id" |
57JID=`ps -p $$ -o jid | tail -1 | tr -d ' '` |
|
57IDCMD="if [ -x $ID ]; then $ID -un; fi" 58 59case ${OSTYPE} in 60FreeBSD) 61 SYSCTL_W="${SYSCTL}" 62 ;; 63NetBSD) 64 SYSCTL_W="${SYSCTL} -w" --- 205 unchanged lines hidden (view full) --- 270 else # a normal daemon 271 _procnamebn=${_procname##*/} 272 _fp_args='_arg0 _argv' 273 _fp_match='case "$_arg0" in 274 $_procname|$_procnamebn|${_procnamebn}:|"(${_procnamebn})"|"[${_procnamebn}]")' 275 fi 276 277 _proccheck=' | 58IDCMD="if [ -x $ID ]; then $ID -un; fi" 59 60case ${OSTYPE} in 61FreeBSD) 62 SYSCTL_W="${SYSCTL}" 63 ;; 64NetBSD) 65 SYSCTL_W="${SYSCTL} -w" --- 205 unchanged lines hidden (view full) --- 271 else # a normal daemon 272 _procnamebn=${_procname##*/} 273 _fp_args='_arg0 _argv' 274 _fp_match='case "$_arg0" in 275 $_procname|$_procnamebn|${_procnamebn}:|"(${_procnamebn})"|"[${_procnamebn}]")' 276 fi 277 278 _proccheck=' |
278 ps 2>/dev/null -o "pid,command" '"$_psargs"' | 279 while read _npid '"$_fp_args"'; do | 279 ps 2>/dev/null -o "pid,jid,command" '"$_psargs"' | 280 while read _npid _jid '"$_fp_args"'; do |
280 case "$_npid" in 281 PID) 282 continue;; 283 esac; '"$_fp_match"' | 281 case "$_npid" in 282 PID) 283 continue;; 284 esac; '"$_fp_match"' |
284 echo -n "$_pref$_npid"; 285 _pref=" " | 285 if [ "$JID" -eq "$_jid" ]; 286 then echo -n "$_pref$_npid"; 287 _pref=" "; 288 fi |
286 ;; 287 esac 288 done' 289 290# debug "in _find_processes: proccheck is ($_proccheck)." 291 eval $_proccheck 292} 293 --- 1166 unchanged lines hidden --- | 289 ;; 290 esac 291 done' 292 293# debug "in _find_processes: proccheck is ($_proccheck)." 294 eval $_proccheck 295} 296 --- 1166 unchanged lines hidden --- |