SHUTDOWNHOOK_ESTABLISH(9) BSD Kernel Developer's Manual SHUTDOWNHOOK_ESTABLISH(9)NAME
shutdownhook_establish, shutdownhook_disestablish -- add or remove a shutdown hook
SYNOPSIS
void *
shutdownhook_establish(void (*fn)(void *), void *arg);
void
shutdownhook_disestablish(void *cookie);
DESCRIPTION
The shutdownhook_establish API is deprecated.
The shutdownhook_establish() function adds fn to the list of hooks invoked by doshutdownhooks(9) at shutdown. When invoked, the hook func-
tion fn will be passed arg as its only argument.
The shutdownhook_disestablish() function removes the hook described by the opaque pointer cookie from the list of hooks to be invoked at
shutdown. If cookie is invalid, the result of shutdownhook_disestablish() is undefined.
Shutdown hooks should be used to perform one-time activities that must happen immediately before the kernel exits. Because of the environ-
ment in which they are run, shutdown hooks cannot rely on many system services (including file systems, and timeouts and other interrupt-
driven services), or even basic system integrity (because the system could be rebooting after a crash).
RETURN VALUES
If successful, shutdownhook_establish() returns an opaque pointer describing the newly-established shutdown hook. Otherwise, it returns
NULL.
EXAMPLES
It may be appropriate to use a shutdown hook to disable a device that does direct memory access, so that the device will not try to access
memory while the system is rebooting.
It may be appropriate to use a shutdown hook to inform watchdog timer hardware that the operating system is no longer running.
SEE ALSO doshutdownhooks(9)BUGS
The names are clumsy, at best.
BSD May 14, 2009 BSD
Check Out this Related Man Page
POWERHOOK_ESTABLISH(9) BSD Kernel Developer's Manual POWERHOOK_ESTABLISH(9)NAME
powerhook_establish, powerhook_disestablish -- add or remove a power change hook
SYNOPSIS
void *
powerhook_establish(const char *name, void (*fn)(int why, void *a), void *arg);
void
powerhook_disestablish(void *cookie);
DESCRIPTION
The powerhook_establish API is deprecated.
The powerhook_establish() function adds fn of the list of hooks invoked by dopowerhooks(9) at power change. When invoked, the hook function
fn will be passed the new power state as the first argument and arg as its second argument.
The powerhook_disestablish() function removes the hook described by the opaque pointer cookie from the list of hooks to be invoked at power
change. If cookie is invalid, the result of powerhook_disestablish() is undefined.
Power hooks should be used to perform activities that must happen when the power situation to the computer changes. Because of the environ-
ment in which they are run, power hooks cannot rely on many system services (including file systems, and timeouts and other interrupt-driven
services). The power hooks are typically executed from an interrupt context.
The different reasons for calling the power hooks are: suspend, standby, and resume. The reason is reflected in the why argument and the
values PWR_SOFTSUSPEND, PWR_SUSPEND, PWR_SOFTSTANDBY, PWR_STANDBY, PWR_SOFTRESUME, and PWR_RESUME. It calls with PWR_SOFTxxx in the normal
priority level while the other callings are protected with splhigh(9). At suspend the system is going to lose (almost) all power, standby
retains some power (e.g., minimal power to USB devices), and at resume power is back to normal.
RETURN VALUES
If successful, powerhook_establish() returns an opaque pointer describing the newly-established power hook. Otherwise, it returns NULL.
SEE ALSO dopowerhooks(9)BSD May 14, 2009 BSD
Hi,
We encounter problem while rebooting the sco 5.06 open server.
When I reboot the server by shutdown -g0 -y -i6 comand the following message is showing
Shutdown Proceeding. Please Wait...........................
/etc/shutdown : 4324 Hangup
At this stage the system takes 30 sec and... (1 Reply)
ok, i know the syntax that goes along with the Shutdown command... but my box never wants to ... well... shutdown.. it only halts, kills all the process's, stalls the comp to a complete stop, but does actually kill the monitor and/or shut off the physical computer. it will reboot properly though,... (3 Replies)
Hello,
How do you make changes to the /etc/system file go into effect without rebooting? BTW, I'm referencing the Solaris 8 OS.
Thanks.
Roy (2 Replies)
Hi,
I am a sysadmin. During long weekends i need to turn off all machines in my lab. Is it possible to shutdown systems using ip address without using ssh.
i read somewhere that shutdown -m "IPADDR" may work. However it seems its a windows specific command.
So my question is how do i... (11 Replies)
Hi there,
I'm currently writing a program/module which makes use of the Linux Security Modules (LSM), which provide hooks for some security .
The bad thing about it is: The function to set the hook to the LSM is not exported. That means, I can't just write a loadable kernel module, but have to... (3 Replies)
I am having exactly the same problem with https://www.unix.com/programming/129264-application-cleanup-during-linux-shutdown.html but the thread is old and closed. The only difference is that I use sigaction() instead of signal(), which is recommended, as far as I know.
This is my code:
... (9 Replies)