sigkill

SIGKILL while allocating memory in C++

家住魔仙堡 提交于 2019-11-27 15:33:56
I'm developing application for an embedded system with limited memory (Tegra 2) in C++. I'm handling NULL results of new and new[] throughout the code which sometimes occurs but application is able to handle this. The problem is that the system kills the process by SIGKILL if the memory runs out completely. Can I somehow tell that new should just return NULL instead of killing the process? I am not sure what kind of OS You are using, but You should check if it supports opportunistic memory allocation like Linux does. If it is enabled, the following may happen: Your new or malloc gets a valid

Killing the children with the parent

99封情书 提交于 2019-11-27 05:34:27
问题 I have a program spawning and communicating with CPU heavy, unstable processes, not created by me. If my app crashes or is killed by SIGKILL , I want the subprocesses to get killed as well, so the user don´t have to track them down and kill them manually. I know this topic has been covered before, but I have tried all methods described, and none of them seem to live up to survive the test. I know it must be possible, since terminals do it all the time. If I run something in a terminal, and

Return a list of running background apps/processes in iOS

本秂侑毒 提交于 2019-11-27 05:22:26
I'm working on a jailbreak app, and want to send SIGKILL messages to specific apps that may be running on a user's device (with their permission, of course). Google is not turning up anything for me. Is there a plist or array that keeps track of running processes? Thanks for any help you all can give, you're wonderful! Make a sysctl API and retrieve the kinfo_proc structure http://fxr.watson.org/fxr/source/sys/kinfo.h?v=DFBSD . This struct has information about running processes.You can run it in a loop until to get info about all processes. Here is a code snippet- extend it to get info of all

SIGKILL signal Handler

谁说我不能喝 提交于 2019-11-26 20:15:17
问题 I have a requirement to write to a log file on reception of any terminate command like SIGTERM AND SIGKILL. I can register for SIGTERM but how can handle the SIGKILL signal? 回答1: You cannot, at least not for the process being killed. What you can do is arrange for the parent process to watch for the child process's death, and act accordingly. Any decent process supervision system, such as daemontools, has such a facility built in. 来源: https://stackoverflow.com/questions/3908694/sigkill-signal

SIGKILL while allocating memory in C++

无人久伴 提交于 2019-11-26 17:13:13
问题 I'm developing application for an embedded system with limited memory (Tegra 2) in C++. I'm handling NULL results of new and new[] throughout the code which sometimes occurs but application is able to handle this. The problem is that the system kills the process by SIGKILL if the memory runs out completely. Can I somehow tell that new should just return NULL instead of killing the process? 回答1: I am not sure what kind of OS You are using, but You should check if it supports opportunistic

How to gracefully handle the SIGKILL signal in Java

依然范特西╮ 提交于 2019-11-25 23:37:14
问题 How do you handle clean up when the program receives a kill signal? For instance, there is an application I connect to that wants any third party app (my app) to send a finish command when logging out. What is the best say to send that finish command when my app has been destroyed with a kill -9 ? edit 1: kill -9 cannot be captured. Thank you guys for correcting me. edit 2: I guess this case would be when the one calls just kill which is the same as ctrl-c 回答1: It is impossible for any