Re: Control-Z the Sleep Signal
On Wednesday 10 June 2009 13:33:19 Martin McCormick wrote: > We use both bind and the ISC DHCP server and are very > satisfied customers. When you use omshell to add a bootP entry, > it inserts it as a clause in the dhcpd.leases file but you still > must specify all the parameters yourself. Perhaps you can use the omapi(3) interfaces. I'm sure the ISC developers would like to know why you cannot and perhaps provide the interfaces you need. Or you could wrap omshell with the input you retrieved. Whichever, it would allow you to get rid of the locks all together by putting the burden on the DHCP server, rather then a shared client program. -- Mel ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Control-Z the Sleep Signal
Mel Flynn writes: > If this is the sole purpose of the program, I would retire it if you're > using > ISC provided software for these services. rndc and omshell can do all of > this > using atomic operations. Information is gathered first, then sent in one > block > to the server, so even if two people try to modify/delete the same > record, the > one that comes first makes the change, and the second one is handled > according > to the new information. Quite true. The ISC software is wonderful but it doesn't deal with static bootP and even worse static IP addresses that have no bootP associated with them. We have tons of both. Dynamic DHCP isn't really a good solution for printers and servers. BootP is much more stable for them since nobody can bump them off. We have some departments on campus that are like herding cats in that there is always somebody hard-coding their IP address in to a DHCP lease, etc. We have other areas where people have had the same dynamic lease for literally years and think it is static. We usually set up a subnet about half dynamic and half static which works well for us. The program I wrote reads the dhcpd.conf file and blocks out the dynamic ranges so one can not assign a static entry in those ranges so it has grown to work with the ISC products. It reads the subnet mask, finds the dynamic ranges and then compares against the A records in DNS to quickly find the next free IP address. We use both bind and the ISC DHCP server and are very satisfied customers. When you use omshell to add a bootP entry, it inserts it as a clause in the dhcpd.leases file but you still must specify all the parameters yourself. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Control-Z the Sleep Signal
On Wednesday 10 June 2009 08:28:14 Martin McCormick wrote: > Mel Flynn writes: > > Agreed. You're solving the wrong problem by mapping CTRL-Z to CTRL-C. The > > questions you should be asking are: > > 1) Why are stale locks bad for the app? > > Because if there is one, nobody else in our group can use the > app to assign IP addresses. I made it back in 1993 so that only > one person could use it at a time because it adds and or deletes > records from the DNS and DHCP servers. If this is the sole purpose of the program, I would retire it if you're using ISC provided software for these services. rndc and omshell can do all of this using atomic operations. Information is gathered first, then sent in one block to the server, so even if two people try to modify/delete the same record, the one that comes first makes the change, and the second one is handled according to the new information. -- Mel ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Control-Z the Sleep Signal
Mel Flynn writes: > Agreed. You're solving the wrong problem by mapping CTRL-Z to CTRL-C. The > questions you should be asking are: > 1) Why are stale locks bad for the app? Because if there is one, nobody else in our group can use the app to assign IP addresses. I made it back in 1993 so that only one person could use it at a time because it adds and or deletes records from the DNS and DHCP servers. > 2) Why do stale locks occur to begin with? > 3) Do the locks really solve the problem you thought you needed them for Now, there's an excellent question. They almost never do and when they do, something very bad has happened and it needs immediate attention. It could be that somebody put the program to sleep because it hung as was recently the case or that it choked so to speak which means it abnormally ended. > 4) Why is it not possible to remove the locks if the PID that created > them is > not instance of said program? The locks are owned by root as the program runs setuid to root chmod 4755. On occasion, I find stuff I did 16 years ago and wonder, What was I thinking? I will revisit the signal handler and make it output an error message on CTRL-Z because we don't want it running if it isn't in use. Thanks for points well taken. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Control-Z the Sleep Signal
On Wednesday 10 June 2009 00:49:16 per...@pluto.rain.com wrote: > Martin McCormick wrote: > > Thanks to all. In this case, I made SIGTSTP have the > > same effect in the program that CTRL-C does (SIGINT) so now > > either signal makes the application remove the lock and quit > > gracefully. > > To each his own, I guess. To anyone familiar with the usual > Unix/Linux conventions, this response to ^Z is going to be > thoroughly unexpected. Is there any reasonable way to do > only the minimum cleanup need for the lock to be safely > removed, and then suspend, reacquiring the lock when resumed? Agreed. You're solving the wrong problem by mapping CTRL-Z to CTRL-C. The questions you should be asking are: 1) Why are stale locks bad for the app? 2) Why do stale locks occur to begin with? 3) Do the locks really solve the problem you thought you needed them for to begin with? 4) Why is it not possible to remove the locks if the PID that created them is not instance of said program? -- Mel ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Control-Z the Sleep Signal
Martin McCormick wrote: > Thanks to all. In this case, I made SIGTSTP have the > same effect in the program that CTRL-C does (SIGINT) so now > either signal makes the application remove the lock and quit > gracefully. To each his own, I guess. To anyone familiar with the usual Unix/Linux conventions, this response to ^Z is going to be thoroughly unexpected. Is there any reasonable way to do only the minimum cleanup need for the lock to be safely removed, and then suspend, reacquiring the lock when resumed? ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Control-Z the Sleep Signal
In the last episode (Jun 10), Polytropon said: > On Tue, 9 Jun 2009 17:07:30 -0500, Dan Nelson wrote: > > ^Z sends a SIGTSTP, which can be caught (or ignored, in your case). > > > > 18SIGTSTP stop process stop signal generated from > > keyboard > > What is the way to get this information? That's from the "signal" manpage. -- Dan Nelson dnel...@allantgroup.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Control-Z the Sleep Signal
Dan Nelson writes: > ^Z sends a SIGTSTP, which can be caught (or ignored, in your case). > > 18SIGTSTP stop process stop signal generated from > keyboard > > According to > > > > % stty -g > > ... status=14:stop=13:susp=1a:time=0:werase=17: ... > ^^^ > > 17SIGSTOP stop process stop (cannot be caught or > > ignored) > > > > And I think that 17 (decimal) is refered to as 1a (hexadecimal) > > in the previous stty command. > > 1a hex just refers to the control code itself (^Z), and doesn't indicate > which signal is sent. Thanks to all. In this case, I made SIGTSTP have the same effect in the program that CTRL-C does (SIGINT) so now either signal makes the application remove the lock and quit gracefully. Again, many thanks to everybody. Martin McCormick ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Control-Z the Sleep Signal
On Wed, 10 Jun 2009 00:15:27 +0200, Erik Trulsson wrote: > Not quite. It indicates (according to stty(1)) that ^Z generates the > SUSP character. > The termios(4) manpage (referenced by stty(1)) says that > > SUSPIf the ISIG flag is enabled, receipt of the SUSP character causes > a SIGTSTP signal to be sent to all processes in the foreground > process group for which the terminal is the controlling terminal, > and the SUSP character is discarded when processed. > > So it appears to be SIGTSTP which is sent by typing ^Z, which agrees with > signal(3) where the SIGTSTP signal is described as "stop signal generated > from keyboard" That's highly interesting. Thanks for the pointer to termios man page. I'm always surprised how well intended things work in FreeBSD. =^_^= -- Polytropon >From Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Control-Z the Sleep Signal
On Tue, 9 Jun 2009 17:07:30 -0500, Dan Nelson wrote: > ^Z sends a SIGTSTP, which can be caught (or ignored, in your case). > > 18SIGTSTP stop process stop signal generated from > keyboard What is the way to get this information? -- Polytropon >From Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Control-Z the Sleep Signal
On Tue, Jun 09, 2009 at 11:42:15PM +0200, Polytropon wrote: > On Tue, 09 Jun 2009 16:30:30 -0500, Martin McCormick > wrote: > > Which signal is sent to a process when one types ^z or > > Control-z? It appears to be SIGSTOP and according to signal's > > man page, this is one signal you can't catch. > > You can check the setting with this command: > > % stty -a > cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = ; > eol2 = ; erase = ^H; erase2 = ^H; intr = ^C; kill = ^U; > lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q; > status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W; > ^ > > This entry indicates that ^Z sends the suspend signal. Not quite. It indicates (according to stty(1)) that ^Z generates the SUSP character. The termios(4) manpage (referenced by stty(1)) says that SUSPIf the ISIG flag is enabled, receipt of the SUSP character causes a SIGTSTP signal to be sent to all processes in the foreground process group for which the terminal is the controlling terminal, and the SUSP character is discarded when processed. So it appears to be SIGTSTP which is sent by typing ^Z, which agrees with signal(3) where the SIGTSTP signal is described as "stop signal generated from keyboard" -- Erik Trulsson ertr1...@student.uu.se ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Control-Z the Sleep Signal
In the last episode (Jun 09), Polytropon said: > On Tue, 09 Jun 2009 16:30:30 -0500, Martin McCormick > wrote: > > Which signal is sent to a process when one types ^z or Control-z? It > > appears to be SIGSTOP and according to signal's man page, this is one > > signal you can't catch. ^Z sends a SIGTSTP, which can be caught (or ignored, in your case). 18SIGTSTP stop process stop signal generated from keyboard > According to > > % stty -g > ... status=14:stop=13:susp=1a:time=0:werase=17: ... ^^^ > 17SIGSTOP stop process stop (cannot be caught or > ignored) > > And I think that 17 (decimal) is refered to as 1a (hexadecimal) > in the previous stty command. 1a hex just refers to the control code itself (^Z), and doesn't indicate which signal is sent. -- Dan Nelson dnel...@allantgroup.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Control-Z the Sleep Signal
On Tue, 09 Jun 2009 16:30:30 -0500, Martin McCormick wrote: > Which signal is sent to a process when one types ^z or > Control-z? It appears to be SIGSTOP and according to signal's > man page, this is one signal you can't catch. You can check the setting with this command: % stty -a cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = ; eol2 = ; erase = ^H; erase2 = ^H; intr = ^C; kill = ^U; lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W; ^ This entry indicates that ^Z sends the suspend signal. According to % stty -g ... status=14:stop=13:susp=1a:time=0:werase=17: ... ^^^ and % man 3 signal says that 17SIGSTOP stop process stop (cannot be caught or ignored) And I think that 17 (decimal) is refered to as 1a (hexadecimal) in the previous stty command. > I have an application with a signal handler I wrote and > I am trying to discourage folks typing CTRL-Z if it hangs > because that does make it seem to go away but it is really still > hanging around and any lock files it created are not removed. > The effect is about as bad as if it crashed and left lock files. > Normally, CTRL-c makes it remove the locks before exiting. If I read the information above correctly, ^Z cannot be caught. (I'm always interested in statements that correct me if I'm wrong.) -- Polytropon >From Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"