Re[7]: Как программу из демона сделать просто консольной?
От: Alex Alexandrov США  
Дата: 22.11.05 21:45
Оценка:
Здравствуйте, Kemm, Вы писали:

K>Здравствуйте, Alex Alexandrov, Вы писали:


D>>>>то искать в сорцах fork()/fork() (два раза должен fork делаться)

K>>>Кому это он должен?
AA>>From Unix Programming FAQ:

K>[skip]

K>И на каких юниксах нынче необходимо два форка делать?

Видимо, на всех, где лидер сессии может случайно заполучить controlling terminal, ненароком сделав что-то вроде open("/dev/tty"). Можно еще O_NOCTTY в open использовать, но

27320 The O_NOCTTY flag was added to allow applications to avoid unintentionally acquiring a
27321 controlling terminal as a side effect of opening a terminal file. This volume of
27322 IEEE Std 1003.1-2001 does not specify how a controlling terminal is acquired, but it allows an
27323 implementation to provide this on open( ) if the O_NOCTTY flag is not set and other conditions
27324 specified in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General Terminal
27325 Interface are met. The O_NOCTTY flag is an effective no-op if the file being opened is not a
27326 terminal device.
... << RSDN@Home 1.1.4 beta 7 rev. 447>>
It's kind of fun to do the impossible (Walt Disney)
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.