This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Intercepting shutdown messges


José Alburquerque wrote:
Hello. This is my first post to this list and I simply have a general question about pseudo terminals which I'm hoping can be answered on this list! As weird as it may sound, I'm trying to write a simple program (in C naturally) to sort of "intercept" shutdown messages when they are sent to terminals (I notice that all my open terminals receive a "The system is going down in XXX minutes" when shutdown is running). To this end, I wrote a simple program that uses opentty() to open a master/slave pseudo terminal pair. I can read and print data sent to the /dev/pts/* file sent to the slave using the master file descriptor, but I'm sort of stuck because when shutdown runs, my program doesn't read the shutdown messages. Anyone have any suggestions as to what I need to add to "intercept" these shutdown messages? Am I going about this the wrong way? Thanks for any help.


By researching and a bit of trial and error, I discovered that it is necessary to use login() to append the utmp file so that the process receives these system messages. Thanks.


--
José Alburquerque


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]