kern_shutdown.c (17768) | kern_shutdown.c (17834) |
---|---|
1/*- 2 * Copyright (c) 1986, 1988, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94 | 1/*- 2 * Copyright (c) 1986, 1988, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94 |
39 * $Id: kern_shutdown.c,v 1.2 1996/08/19 20:06:59 julian Exp $ | 39 * $Id: kern_shutdown.c,v 1.3 1996/08/22 03:50:20 julian Exp $ |
40 */ 41 42#include "opt_ddb.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/reboot.h> 47#include <sys/msgbuf.h> --- 57 unchanged lines hidden (view full) --- 105/* 106 * there are two shutdown lists. Some things need to be shut down 107 * Earlier than others. 108 */ 109static sle_p shutdown_list1; 110static sle_p shutdown_list2; 111 112 | 40 */ 41 42#include "opt_ddb.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/reboot.h> 47#include <sys/msgbuf.h> --- 57 unchanged lines hidden (view full) --- 105/* 106 * there are two shutdown lists. Some things need to be shut down 107 * Earlier than others. 108 */ 109static sle_p shutdown_list1; 110static sle_p shutdown_list2; 111 112 |
113 114/* This implements a "TEXT_SET" for cleanup functions */ 115static void dummy_cleanup __P((void)); 116static void 117dummy_cleanup() {} 118TEXT_SET(cleanup_set, dummy_cleanup); 119 120typedef void (*cleanup_func_t)(void); 121extern const struct linker_set cleanup_set; 122static const cleanup_func_t *cleanups = 123 (const cleanup_func_t *)&cleanup_set.ls_items[0]; | |
124static void dumpsys(void); 125 126#ifndef _SYS_SYSPROTO_H_ 127struct reboot_args { 128 int opt; 129}; 130#endif 131/* ARGSUSED */ --- 40 unchanged lines hidden (view full) --- 172 * anything machine dependant in it. 173 */ 174__dead void 175boot(howto) 176 int howto; 177{ 178 sle_p ep; 179 | 113static void dumpsys(void); 114 115#ifndef _SYS_SYSPROTO_H_ 116struct reboot_args { 117 int opt; 118}; 119#endif 120/* ARGSUSED */ --- 40 unchanged lines hidden (view full) --- 161 * anything machine dependant in it. 162 */ 163__dead void 164boot(howto) 165 int howto; 166{ 167 sle_p ep; 168 |
180 /* 181 * eventually the at_shutdown() method will totally replace the 182 * linker set but for now leave them both (so 3rd partys 183 * modules that might use it can not break). 184 * The linker set is no good for LKMs etc. 185 */ 186 if ((howto & RB_NOSYNC) == 0 ) { 187 printf("\ncleaning up... "); 188 while (*cleanups) { 189 printf("Using obsolete shutdown callout..\n"); 190 printf("update code to use at_shutdown()\n"); 191 (**cleanups++)(); 192 } 193 } | |
194 ep = shutdown_list1; 195 while (ep) { 196 shutdown_list1 = ep->next; 197 (*ep->function)(howto, ep->arg); 198 ep = ep->next; 199 } 200 if (!cold && (howto & RB_NOSYNC) == 0 && waittime < 0) { 201 register struct buf *bp; --- 234 unchanged lines hidden (view full) --- 436{ 437 sle_p *epp, ep; 438 int count; 439 440 count = 0; 441 epp = &shutdown_list1; 442 ep = *epp; 443 while (ep) { | 169 ep = shutdown_list1; 170 while (ep) { 171 shutdown_list1 = ep->next; 172 (*ep->function)(howto, ep->arg); 173 ep = ep->next; 174 } 175 if (!cold && (howto & RB_NOSYNC) == 0 && waittime < 0) { 176 register struct buf *bp; --- 234 unchanged lines hidden (view full) --- 411{ 412 sle_p *epp, ep; 413 int count; 414 415 count = 0; 416 epp = &shutdown_list1; 417 ep = *epp; 418 while (ep) { |
444 if ((ep->function == function) && (ep->arg = arg)) { | 419 if ((ep->function == function) && (ep->arg == arg)) { |
445 *epp = ep->next; 446 free(ep, M_TEMP); 447 count++; 448 } else { 449 epp = &ep->next; 450 } 451 ep = *epp; 452 } 453 epp = &shutdown_list2; 454 ep = *epp; 455 while (ep) { | 420 *epp = ep->next; 421 free(ep, M_TEMP); 422 count++; 423 } else { 424 epp = &ep->next; 425 } 426 ep = *epp; 427 } 428 epp = &shutdown_list2; 429 ep = *epp; 430 while (ep) { |
456 if ((ep->function == function) && (ep->arg = arg)) { | 431 if ((ep->function == function) && (ep->arg == arg)) { |
457 *epp = ep->next; 458 free(ep, M_TEMP); 459 count++; 460 } else { 461 epp = &ep->next; 462 } 463 ep = *epp; 464 } 465 return (count); 466} 467 | 432 *epp = ep->next; 433 free(ep, M_TEMP); 434 count++; 435 } else { 436 epp = &ep->next; 437 } 438 ep = *epp; 439 } 440 return (count); 441} 442 |