Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > C/C++: Программирование под Unix/Linux > close-on-exec


Автор: volkrey 1.6.2009, 20:42
close-on-exec
скажите пожалуйста что это означает, везде в литературе и в манах это используется, а что это - не понятно, и толком не объясненено

спасибо

Автор: MAKCim 1.6.2009, 22:02
man 2 execve
Цитата

          By default, file descriptors remain open across an  execve().   File
          descriptors  that  are  marked  close-on-exec  are  closed;  see the
          description of FD_CLOEXEC in fcntl(2).  (If  a  file  descriptor  is
          closed,  this will cause the release of all record locks obtained on
          the underlying file by this process.   See  fcntl(2)  for  details.)
          POSIX.1-2001  says that if file descriptors 0, 1, and 2 would other‐
          wise be closed after a successful execve(), and  the  process  would
          gain  privilege  because  the set-user_ID or set-group_ID permission
          bit was set on the executed  file,  then  the  system  may  open  an
          unspecified  file  for each of these file descriptors.  As a general
          principle, no portable  program,  whether  privileged  or  not,  can
          assume  that  these three file descriptors will remain closed across
          an execve().

man 2 fcntl
Цитата

       Currently, only one such flag is defined: FD_CLOEXEC, the
       close-on-exec flag.  If the FD_CLOEXEC bit is 0,  the  file  descriptor
       will remain open across an execve(2), otherwise it will be closed.

Автор: volkrey 2.6.2009, 07:39
thanks

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)