do you believe X-application will "kill" the CDE and come back to login dialog


 
Thread Tools Search this Thread
Top Forums Programming do you believe X-application will "kill" the CDE and come back to login dialog
# 1  
Old 07-17-2002
Question do you believe X-application will "kill" the CDE and come back to login dialog

1 . Thanks you for reading the letter
2 . I have programe a X-application .Sometimes, I run it from terminal of CDE ,it "kill" the CDE and I meet the login dialog . I debug it . I find that the SIGHUP caused the X-app died .I do not run it from terminal of CDE ,I run it "click button" from panel , it does the same .(the CDE is killed ,come back to login dialog,the X-app receive the SIGHUP)
3 . I wonder when I run X-app from panel ,it does not have a control terminal ,who send it SIGHUP .
I use "ps axj" find the X-app pid = 8874 ppid = 1 pgid = 8700 sessid = 8700 tty = ??
4 . How can I find the session leader use ps command or others
5 .My email is chenhao_no4@yahoo.com.cn
# 2  
Old 07-17-2002
Please read our rules. We don't allow posters to request email responses.

I don't use CDE. But if your program is getting a SIGHUP, there is a way to find out why. You can use sigaction() to install a signal handler. A signal handler installed by sigaction will be called with a pointer to a siginfo structure. The handler can examine the values in the structure to figure out why the signal arrived. Of particular interest are si_pid (sending process ID) and si_uid (sending user ID). The handler could log this info. It could even run "ps" for the pid in question and log that. Then after it exits, you will know exactly why.

And a process can always call getpgrp() to get its own process group id. And it can call getsid() to get the process group id of its session leader.
# 3  
Old 07-19-2002
1 . thanks Perderabo
2 . I do a experiment in Compaq Tru64 Unix.
It (X-applicaton ) "kill" the CDE sometimes .
When the X-Application "kill" the CDE and let me come back to login dialog , it catch all signal SIGHUP (I use sigacton() (its sa_flags = SA_SIGINFO) ). signal SIGHUP , which sent by pid = 0 ,uid = 0 ( in fact it is [kernel idle] )
I add the tcgetsid(STDIN_FILENO) in source code , I find that When I launch the X-applicaion the "session leader" is 2345 (it will change ) , and When I launch the X-application from a menu button , its "session leader" is -1.




I can not understand why the kernel send the SIGHUP . Because :

3. "the signal is sent to the controlling process(session leader) associated with a controlling terminal if a disconnect is detected bye the terminal inferface" . But When I type the command "ps aux ",I found that the TTY of the X-applicaton is ??? , which indicate that it do not have a controlling terminal device (maybe I am wrong) . Since the X-applicaton does not have a controlling terminal , Why does the kernel sent SIGHUP to it

4 "the signal is also generated if the session leader terminato" . But I use tcgetsid(STDIN_FILENO), I find that the session leader is -1 . Since the session leader is dead (because it is -1) , how can it receive SIGHUP . (sometimes when the session leader is -1 ,the X-applicaton work correctly)
# 4  
Old 07-19-2002
I don't use Compaq. But there is something odd here. Yes, I would agree that if your tty field on "ps" is ??? then you have no controlling terminal. However it may be that you have either a session leader or a process group leader who does have a controlling terminal. I would just take extreme measures to make sure that this is not the case.

1) close all files. If no files are open, then no tty can be open.

2) fork() and let the parent exit. The child will continue to run. The parent might have been a process group leader. But the child cannot be one.

3) setsid() to become a session leader and process group leader.

4) fork() and let the parent exit. At this point the child has no process group leader nor a session group leader. It has no tty's open so it cannot have a controlling tty nor is it associated in any way with a process with a controlling terminal.

5) now run, but never open a tty. If you need to open a tty, fork, let the child it, then let the child exit.

This is more than should really be needed. But I'll bet the rent that it works.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. Shell Programming and Scripting

Help on using "dialog" in shell

hello, i'm experimenting on "dialog" in shell scripting consider an example : dialog --passwordbox "password" 10 30 i need to take the password typed to a variable. how can i do it. i tried it in perl by backticking the command. but its not working. give me a solution ASAP......:) (2 Replies)
Discussion started by: sunjujohn
2 Replies

5. UNIX for Dummies Questions & Answers

how to install "source" command!/ broken "login.cl"!

Hello, I am new to this forums and this is my first "asking help" message! i have 2 problems: 1- for unknown reasons the "source" command is not avalable in my system (UBUNTU). i can't either see it in my bin directory! 2- again for unknown reasons the "login.cl" file in the home... (0 Replies)
Discussion started by: astrosona
0 Replies

6. UNIX for Dummies Questions & Answers

HoHow to compile Linux dialog - "curses.h" missing ?

Hi, I tried native compile Linux dialog for Linux embedded device and got "curses.h" error message. As Linux dialog is already compiled and working as Debian .deb package (installed it). What is a way to import curses.h from other package sources to work for dialog sources compilation in my... (2 Replies)
Discussion started by: darius2
2 Replies

7. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

8. UNIX for Dummies Questions & Answers

No utpmx entry: you must exec "login" from lowest level "shell"

Hi I have installed solaris 10 on an intel machine. Logged in as root. In CDE, i open terminal session, type login alex (normal user account) and password and i get this message No utpmx entry: you must exec "login" from lowest level "shell" :confused: What i want is: open various... (0 Replies)
Discussion started by: peterpan
0 Replies
Login or Register to Ask a Question