Jan 6, 2008


Not until I noticed the FD_CLOEXEC flag of file descriptor, I thought all file handlers will be closed on calling exec(), and stdin, stdout, stderr will be reopened too.

But it seems not, After some testing, I think that the file handlers might be all untouched on calling exec(), opened files remained opened, closed stdio remained closed.

But if the file descriptor have set with FD_CLOEXEC flag, it'll be closed when calling exec().

About signal handling function

After running some test on FreeBSD 5.4-STABLE (Duo core machine) I've found that:

1. Signal handler function and main program won't execute concurrently.
(Not time-shared, Non-interleaved execution, Won't run on different core)

2. If multiple signal arrives:
a. Signal handler functions won't execute concurrently.
b. Later come serves first.
c. The signal number does not mean the priority of signal.
(ex: When USR1 is processing, USR2 arrives, USR2 will be served immediately. Vice versa.)
d. If the same signal is processing, and comes again, it'll be stacked. And also, later come serves first.
ex: When
USR1(a) processed in the half.
USR2(a) is processing.
USR1(b) comes again.
USR2(b) comes again.
The remaining execution order will be:
USR2(a), USR2(b), USR1(b), USR1(a), Main Program

Jan 2, 2008

Using X11Forwarding

It's a lot easier then I thought:

On the ssh server(which runs X-Client):
edit /etc/ssh/sshd_config
uncomment "#X11Forwarding no"
and modify it as "X11Forwarding yes"

On the ssh client(which has X-Server running)
edit /etc/ssh/ssh_config
uncomment "#ForwardX11 no"
and modify it as "ForwardX11 yes"

Or simply add "-X" argument when connecting to server.

If it success, after login to server, type

$ export | grep DISPLAY

you should see something like

declare -x DISPLAY="localhost:10.0"