[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sys_execve in apm.c
"Jason Coene" <jcoene@rochester.rr.com> writes:
> Hello,
>
> I am trying to make my custom kernel go through standard shutdown
> (/sbin/halt -p) when the power button is pressed (to invoke apm value
> APM_SYS_STANDBY_RESUME). I have tried toying with the sys_execve function,
> however cant seem to make it work properly.
>
> Is there anywhere i can find a syntax document like a manual page on this
> function? Ive tried searching, and it certainly does not appear to take the
> same params as execve. I had quite a lengthy look at kern/init_main.c and
> where it exec's init as its exit, there seems to be a lot of bloat
> surrounding the use of this function.
>
> Does anyone know of a manual page, a simple sample of code, or another way
> for me to address this? What i thought to be decent code that i wrote for it
> gave me loads and loads of compiler errors -- i guess im a little too new to
> BSD kernel programming and used to having the luxury of a broader set of
> functions.
You _don't_ want to call syscall function from within the kernel. It's really
hard. The only exception is calling sys_execve for init (that's a bootstrap
problem) and sys_sync() (because it doesn't take any parameters).
To solve this I would suggest some kind of char device that communicates this
event to some userland daemon that does the halt.
//art