Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/o/openfd.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/o/openfd.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/o/openfd.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/o/openfd.html on line 8
Open for private access a file associated with a given descriptor
#include <unistd.h>
int openfd( int fd,
int oflag );
- fd
- A file descriptor associated with the file that you want to open.
- oflag
- How you want to open the file; a combination of the following bits:
- O_RDONLY — permit the file to be only read.
- O_WRONLY — permit the file to be only written.
- O_RDWR — permit the file to be both read and
written.
- O_APPEND — cause each record that's written to
be written at the end of the file.
- O_TRUNC — truncate the file to contain no data.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The openfd() function opens the file associated with the file descriptor, fd.
This is similar to dup(),
except the new fd has private access modes and offset.
The access mode, oflag, must be equal to or more restrictive than the access mode of the source fd.
A file descriptor, or -1 if an error occurred
(errno is set).
- EBADF
- Invalid file descriptor fd.
- EACCES
- The access mode specified by oflag isn't equal to or more restrictive
than the access mode of the source fd.
- EBUSY
- Sharing mode (sflag) was denied due to a conflicting open (see
sopenfd()).
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
int main ( void )
{
int fd, fd2, oflag;
fd = open ("/etc/passwd", O_RDONLY);
fd2 = openfd ( fd, O_RDONLY );
return EXIT_SUCCESS;
}
QNX Neutrino
Safety: | |
Cancellation point |
Yes |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
dup(),
sopenfd()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/o/openfd.html on line 183
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/o/openfd.html on line 183