This is Unofficial EPICS BASE Doxygen Site
atReboot.cpp
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2013 UChicago Argonne LLC, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * EPICS BASE is distributed subject to a Software License Agreement found
7 * in file LICENSE that is included with this distribution.
8 \*************************************************************************/
9 /* atReboot.cpp */
10 
11 /* Author: Marty Kraimer Date: 30AUG2003 */
12 
13 #include <stdio.h>
14 
15 #include "epicsFindSymbol.h"
16 #include "epicsExit.h"
17 
18 extern "C" {
19 
20 typedef int (*sysAtReboot_t)(void(func)(void));
21 
22 void atRebootRegister(void)
23 {
24  sysAtReboot_t sysAtReboot = (sysAtReboot_t) epicsFindSymbol("_sysAtReboot");
25 
26  if (sysAtReboot) {
27  STATUS status = sysAtReboot(epicsExitCallAtExits);
28 
29  if (status) {
30  printf("atReboot: sysAtReboot returned error %d\n", status);
31  }
32  } else {
33  printf("BSP routine sysAtReboot() not found, epicsExit() will not be\n"
34  "called by reboot. For reduced functionality, call\n"
35  " rebootHookAdd(epicsExitCallAtExits)\n");
36  }
37 }
38 
39 }
pvd::Status status
#define printf
Definition: epicsStdio.h:41
int(* sysAtReboot_t)(void(func)(void))
Definition: atReboot.cpp:20
Extended replacement for the Posix exit and atexit routines.
void atRebootRegister(void)
Definition: atReboot.cpp:22
LIBCOM_API void *epicsStdCall epicsFindSymbol(const char *name)
Definition: osdFindSymbol.c:23
LIBCOM_API void epicsExitCallAtExits(void)
Internal routine that runs the registered exit routines.
Definition: epicsExit.c:102