[BusyBox] ctrl-c exits kills init:getty

Brian T. btuch at usa.net
Mon Apr 28 15:42:00 UTC 2003


I noticed that when hitting ctrl-c when logged into the console, the
following is in /var/log/messages :

Apr 28 10:23:02 System log daemon exiting.
Apr 28 10:23:02 syslogd started: BusyBox v0.60.5 (2003.04.28-15:04+0000)
Apr 28 10:23:03 init: Process '/bin/getty 9600 -' (pid 65) exited.
Scheduling it for restart.
Apr 28 10:23:03 init: Starting pid 74, console /dev/ttyS0: '/bin/getty'
Apr 28 10:23:07 login[74]: root login  on `ttyS0

Looks like init is killing getty rather than allowing the shell to grab the
SIG, is that right?

-Brian


> >
> > >
> > > telnet in again, look up the pid of tail and then cat
> > /proc/<tailpid>/status
> > > and check the ignored signal list.  Are bits 1 and 2 set in SigIgn?
If
> > so,
> > > that's why you can't CTRL-C it.
> >
> > Telnet is not effected, only console access.
> >
> > > I fixed it by ditching utelnetd and putting the busybox telnetd in
> > instead.
> > > Since this makes the call to daemon(), I don't need the silly
> redirections
> > > and backgrounding in the startup script.
> >
> > I am using an embedded telnetd, not the busybox one, but it works fine.
> >
> > >
> > > I have now discovered another ash bug that affects the use of trap to
> trap
> > > SIGINT.  If you have command-line editing enabled such that cmdedit.c
is
> > > reading the characters and you press CTRL-C, cmdedit.c catches it
> (because
> > > it's set ISIG on the terminal) and notices it, but does not notify the
> > shell
> > > to execute the trap handler for SIGINT.
> >
> > I am using GNU bash, version 2.05.0(1)-release, not ash, but here is the
> > /proc info from a console shell:
> >
> > [root at JBMgateway-v50 root]# ps ax
> >   PID TTY      STAT   TIME COMMAND
> >     1 ?        S      0:04 init
> >     2 ?        SW     0:00 [keventd]
> >     3 ?        SWN    0:00 [ksoftirqd_CPU0]
> >     4 ?        SW     0:00 [kswapd]
> >     5 ?        SW     0:00 [bdflush]
> >     6 ?        SW     0:00 [kupdated]
> >     7 ?        SW     0:00 [mtdblockd]
> >    13 ?        SWN    0:01 [jffs2_gcd_mtd1]
> >    28 ?        S      0:00 /bin/cron
> >    43 ?        SW     0:00 [eth0]
> >    50 ?        S      0:00 /sbin/klogd -n
> >    51 ?        S      0:00 /bin/inetd
> >    55 ?        S      0:05 /bin/sshd
> >    74 ttyS0    S      0:00 /sbin/syslogd -n
> >    75 ?        S      0:00 -sh
> >    76 ?        R      0:00 ps ax
> > [root at JBMgateway-v50 root]# cat /proc/75/status
> > Name:   sh
> > State:  S (sleeping)
> > Tgid:   75
> > Pid:    75
> > PPid:   1
> > TracerPid:      0
> > Uid:    0       0       0       0
> > Gid:    0       0       0       0
> > FDSize: 256
> > Groups: 0 1 2
> > VmSize:     1836 kB
> > VmLck:         0 kB
> > VmRSS:      1028 kB
> > VmData:       88 kB
> > VmStk:        12 kB
> > VmExe:       472 kB
> > VmLib:      1212 kB
> > SigPnd: 0000000000000000
> > SigBlk: 0000000000010000
> > SigIgn: 0000000000384004
> > SigCgt: 000000004b813efb
> > CapInh: 0000000000000000
> > CapPrm: 00000000fffffeff
> > CapEff: 00000000fffffeff
> > [root at JBMgateway-v50 root]#
> >




More information about the busybox mailing list