When the SIGTTOU is delivered
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > When the SIGTTOU is delivered




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    When the SIGTTOU is delivered  
Bin Chen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-25-07 06:22 AM

Hi,

The manual said it is delivered when a background process try to write
to control tty, so I wrote a small program to test, it can't receive
the signal.

gcc a.c -o a
./a &

a.c:
#include <signal.h>
#include <unistd.h>
#include <stdio.h>

void ttin()
{
printf("ttin.\n");
return;
}

void ttou()
{
printf("ttou.\n");
return;
}

main()
{
signal(SIGTTIN, ttin);
signal(SIGTTOU, ttou);

//	getchar();
putchar('a');
}

So what's the problem.

Thanks.
Bin






[ Post a follow-up to this message ]



    Re: When the SIGTTOU is delivered  
Alan Curry


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-25-07 06:22 AM

In article <1182739515.093413.224200@j4g2000prf.googlegroups.com>,
Bin Chen  <binary.chen@gmail.com> wrote:
>Hi,
>
>The manual said it is delivered when a background process try to write
>to control tty, so I wrote a small program to test, it can't receive
>the signal.

Hopefully your manual also says, somewhere, that SIGTTOU is only sent if the
tty has the TOSTOP flag enabled. stty tostop, or see tcsetattr(3) to set it
from within your C code.

>void ttou()
>{
>	printf("ttou.\n");

Nasty. Writing to the tty from within the signal handler that gets invoked
when you try to write to the tty. And it's in the background so there's no
^C'ing it. You got me. (I kill -9'ed it from another tty).

>	return;
>}

--
Alan Curry
pacman@world.std.com





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:37 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register