Operating System - HP-UX
1825775 Members
2367 Online
109687 Solutions
New Discussion

System call to make a TOC

 
SOLVED
Go to solution
Olivier Masse
Honored Contributor

System call to make a TOC

Hi,

Is there a system call available to invoke a TOC directly from a C program? I can't rely on doing a system() to run adb or some other hack. Of course, this wacky program would be run as root.

As to why I would be silly enough to want to do this, don't ask. :)

Thanks
8 REPLIES 8
rajdev
Valued Contributor

Re: System call to make a TOC

Hi,

I don't think there is any documented panic sys call..., but /usr/include/sys/kern_svcs.h lists panic as extern void panic __((const char *s));
but problem is we don't know which library has the code, so cannot compile it....

also the panic routine is there in kernel,you can check with nm /stand/vmunix and grep for panic ( there will be a lot) ...
but i don't know if its possible to extract that code and use it as a library. ...

I think someone with programming skills should be able to doit.

Regards,
RD
Dennis Handly
Acclaimed Contributor

Re: System call to make a TOC

>I can't rely on doing a system() to run adb or some other hack.

Why not? (Of course you have to know what hack to do?)

>rajdev: but problem is we don't know which library has the code, ...

Right.

>but i don't know if its possible to extract that code ... I think someone with programming skills should be able to do it.

It isn't that easy. A syscall would have to be added or a new driver, that would call panic.
Olivier Masse
Honored Contributor

Re: System call to make a TOC

Many of my servers boot on SAN and if I unpresent the boot disk by error or unplug both fibers, all I/O will hang until this is restored. That is fine, but there is one particular case where I would like to be able to TOC a system if it's hung in that state. Since it's hung on I/O, adb cannot be loaded.

ServiceGuard can TOC a server without the need of any special driver, and it does not seem to modify the kernel upon installation so there is surely a way to do this -- question is, how.

Thanks
Steven E. Protter
Exalted Contributor

Re: System call to make a TOC

Shalom,

You can TOC your server from the console.

To try and do it with software is dangerous and untested.

You really do want to go where no admin has come before.

Engage warp drive and don't try it on a production system.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Solution

Re: System call to make a TOC

Olivier,

There is no public interface because there is no reliable way of TOC'ing a system from user space (TOC'ing a live system usually has to occur when the system is hung which means you probably won't be able to enter an OS command to do this)

>>ServiceGuard can TOC a server without the need of any special driver, and it does not seem to modify the kernel upon installation so there is surely a way to do this -- question is, how.

Actually Serviceguard does use a special driver - it's not installed with Serviceguard cos it already a core part of the OS that Serviceguard uses, and Serviceguard doesn't talk to the component of the kernel which manages the TOC process through system calls, but through unpublished ioctl's to the drivers device file. This is the same driver you use to talk to PDC/EFI when you run a setboot command.

And strictly speaking of course, Serviceguard doesn't actually TOC a system, it *stops it* from being TOC'd. Using the unpublished interface it sets a timer in the kernel, and updates it every time it gets a heartbeat. If the timer ever managed to count down to zero its the kernel that issues the TOC.

So the only way you could do this would be to write yourself an expect script which connected to your MP/GSP and issued a TC... which you may as well run manually anyway.

...and I am going to ask - why do you want to do this?

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Olivier Masse
Honored Contributor

Re: System call to make a TOC

Looks like doing this is not as trivial as I expected, after all. Too bad... It seemed like a good idea at the time.

Since someone asked... I boot on SAN and was looking into the possibility of writing a monitor that would have TOC'd my server should disk I/O become completely hung due to a problem on the fabric. My guess is the EMS HA monitor hangs as well in this situation (didn't try it) so it would not be of any help. Invoking reboot() probably won't work either in that scenario.

Thanks to all of you.

Re: System call to make a TOC

Olivier,

Talking to a colleague, they had this working in a Serviceguard cluster by using EMS monitors (lv_summary or pv_summary) combined with the NODE_FAIL_FAST_ENABLED=YES.

I guess with EMS the code to check the status is already in-memory.

Of course if you're not using Serviceguard that doesn't help much.

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Olivier Masse
Honored Contributor

Re: System call to make a TOC

Thanks to everyone.