Sponsored Content
Top Forums Programming Problem on capturing system Shutdown Post 302847687 by hakermania on Tuesday 27th of August 2013 02:55:05 PM
Old 08-27-2013
I just downloaded the source code of ettercap-graphical (a well know application) and it doesn't use async-safe functions in the code (fprintf is being used, user interface is being normally shut down, the log file is flushed and closed). So how "strict" is it to make async-safe functions?

I also have this simple question: Why not use async-unsafe functions after all? The worse thing that could happen would be the application to crash or to be in a loop easily terminated with SIGKILL. The application was going to forcefully terminate after all. At least give it a chance to do a proper cleanup.

As for simulating shutdown: Now I am simulating shutdown with simply sending SIGTERM to my process. As I said before, this is not the only thing that really happens, because when I send SIGTERM it runs the handler without any problem. So, the system does something else that I am unaware of (I highly doubt that it really spends time on checking whether the function that is to be called is async-safe or not). So, I simply asked whether there is a better way to simulate the shutdown for only one process, because simply sending SIGTERM is not the best way. I don't believe I am being irrational.
 

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Capturing Oracle Shutdown error

Hi, Iam calling 3 sql scripts through one shell script 'rmia.sh'. Till now this was working fine, but last time while calling the SQL scripts, Oracle was down. But amazingly the exit status was '0' (success)!!! Below is the shell code: #!/usr/bin/ksh -x assign_file asql a.sql 1... (15 Replies)
Discussion started by: ganapati
15 Replies

2. Shell Programming and Scripting

Shutdown a system by MAC?

Ok here is the problem we have 2 v440 with same IP address running solars 9. one remains on the other remains off. They are both configured exactly the same for redundant purposes for the software we use. This was the best/worst idea. Great because down time is only a mere minutes. The bad is the... (7 Replies)
Discussion started by: deaconf19
7 Replies

3. Solaris

logs for system shutdown

I am working on a SUN T2000 machine with Solaris 10 running on it. When I checked the system this morning, I found it to be turned off. The lastreboot command showed that the system had been shut down the previous night. I want to find out how the system was shut down. I have run hardware health... (2 Replies)
Discussion started by: batman727
2 Replies

4. Shell Programming and Scripting

Sending mail on system shutdown

I want to only send a mail before my system goes for a shutdown or reboot. I don't want a mail when it comes up after a reboot or is normally started.. How can i achieve this? (2 Replies)
Discussion started by: proactiveaditya
2 Replies

5. Windows & DOS: Issues & Discussions

system restarts after shutdown!!

Hello, from last few days my laptop is not whutting down properly.. when ever i ty to shutdown it restarts again.. what may be problem?? antivirus is updated till date.. and i use windows xp sp2.... regards, deepak. (5 Replies)
Discussion started by: smarty86
5 Replies

6. Shell Programming and Scripting

Capturing awk's system(cmd) output

Hi everybody, I am working on a bigger awk script in which one part is comparing the size of two files. I want to evaluate which file is bigger and then just save the bigger one. I got it all working except for the part where I want to figure out which file is bigger; the one awk is currently... (2 Replies)
Discussion started by: iMeal
2 Replies

7. Solaris

Shutdown system option

I am working on sunos solaris. I want to know which is good for system shut-down ? (3 Replies)
Discussion started by: Jitesh Varshney
3 Replies

8. Red Hat

shutdown system/myeclipse

Hi All, I have one situation to shut-down the system through shell script.I need script command to shut-down the system and process should end(safe-mode) the MyEclipse. (0 Replies)
Discussion started by: stsivaraj
0 Replies
tevent_queue_tutorial(3)					      tevent						  tevent_queue_tutorial(3)

NAME
tevent_queue_tutorial - The tevent_queue tutorial Introduction A tevent_queue is used to queue up async requests that must be serialized. For example writing buffers into a socket must be serialized. Writing a large lump of data into a socket can require multiple write(2) or send(2) system calls. If more than one async request is outstanding to write large buffers into a socket, every request must individually be completed before the next one begins, even if multiple syscalls are required. To do this, every socket gets assigned a tevent_queue struct. Creating a serialized async request follows the usual convention to return a tevent_req structure with an embedded state structure. To serialize the work the requests is about to so, instead of directly starting or doing that work, tevent_queue_add must be called. When it is time for the serialized async request to do its work, the trigger callback function tevent_queue_add was given is called. In the example of writing to a socket, the trigger is called when the write request can begin accessing the socket. How does this engine work behind the scenes? When the queue is empty, tevent_queue_add schedules an immediate call to the trigger callback. The trigger callback starts its work, likely by starting other async subrequests. While these async subrequests are working, more requests can accumulate in the queue by tevent_queue_add. While there is no function to explicitly trigger the next waiter in line, it still works: When the active request in the queue is done, it will be destroyed by talloc_free. Talloc_free of an serialized async request that had been added to a queue will trigger the next request in the queue via a talloc destructor attached to a child of the serialized request. This way the queue will be kept busy when an async request finishes. Example * Metze: Please add a code example here. * Version 0.9.8 Tue Jun 17 2014 tevent_queue_tutorial(3)
All times are GMT -4. The time now is 03:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy