Current Path : /usr/opt/openssl11/share/doc/openssl/html/man3/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/opt/openssl11/share/doc/openssl/html/man3/BIO_new_fd.html |
<?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>BIO_s_fd</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rev="made" href="mailto:root@hsxx.drive.ne.jp" /> </head> <body style="background-color: white"> <!-- INDEX BEGIN --> <div name="index"> <p><a name="__index__"></a></p> <ul> <li><a href="#name">NAME</a></li> <li><a href="#synopsis">SYNOPSIS</a></li> <li><a href="#description">DESCRIPTION</a></li> <li><a href="#notes">NOTES</a></li> <li><a href="#return_values">RETURN VALUES</a></li> <li><a href="#examples">EXAMPLES</a></li> <li><a href="#see_also">SEE ALSO</a></li> <li><a href="#copyright">COPYRIGHT</a></li> </ul> <hr name="index" /> </div> <!-- INDEX END --> <p> </p> <hr /> <h1><a name="name">NAME</a></h1> <p>BIO_s_fd, BIO_set_fd, BIO_get_fd, BIO_new_fd - file descriptor BIO</p> <p> </p> <hr /> <h1><a name="synopsis">SYNOPSIS</a></h1> <pre> #include <openssl/bio.h></pre> <pre> const BIO_METHOD *BIO_s_fd(void);</pre> <pre> int BIO_set_fd(BIO *b, int fd, int c); int BIO_get_fd(BIO *b, int *c);</pre> <pre> BIO *BIO_new_fd(int fd, int close_flag);</pre> <p> </p> <hr /> <h1><a name="description">DESCRIPTION</a></h1> <p><code>BIO_s_fd()</code> returns the file descriptor BIO method. This is a wrapper round the platforms file descriptor routines such as <code>read()</code> and <code>write()</code>.</p> <p><code>BIO_read_ex()</code> and <code>BIO_write_ex()</code> read or write the underlying descriptor. <code>BIO_puts()</code> is supported but <code>BIO_gets()</code> is not.</p> <p>If the close flag is set then <code>close()</code> is called on the underlying file descriptor when the BIO is freed.</p> <p><code>BIO_reset()</code> attempts to change the file pointer to the start of file such as by using <strong>lseek(fd, 0, 0)</strong>.</p> <p><code>BIO_seek()</code> sets the file pointer to position <strong>ofs</strong> from start of file such as by using <strong>lseek(fd, ofs, 0)</strong>.</p> <p><code>BIO_tell()</code> returns the current file position such as by calling <strong>lseek(fd, 0, 1)</strong>.</p> <p><code>BIO_set_fd()</code> sets the file descriptor of BIO <strong>b</strong> to <strong>fd</strong> and the close flag to <strong>c</strong>.</p> <p><code>BIO_get_fd()</code> places the file descriptor in <strong>c</strong> if it is not NULL, it also returns the file descriptor.</p> <p><code>BIO_new_fd()</code> returns a file descriptor BIO using <strong>fd</strong> and <strong>close_flag</strong>.</p> <p> </p> <hr /> <h1><a name="notes">NOTES</a></h1> <p>The behaviour of <code>BIO_read_ex()</code> and <code>BIO_write_ex()</code> depends on the behavior of the platforms <code>read()</code> and <code>write()</code> calls on the descriptor. If the underlying file descriptor is in a non blocking mode then the BIO will behave in the manner described in the <em>BIO_read_ex(3)</em> and <em>BIO_should_retry(3)</em> manual pages.</p> <p>File descriptor BIOs should not be used for socket I/O. Use socket BIOs instead.</p> <p><code>BIO_set_fd()</code> and <code>BIO_get_fd()</code> are implemented as macros.</p> <p> </p> <hr /> <h1><a name="return_values">RETURN VALUES</a></h1> <p><code>BIO_s_fd()</code> returns the file descriptor BIO method.</p> <p><code>BIO_set_fd()</code> always returns 1.</p> <p><code>BIO_get_fd()</code> returns the file descriptor or -1 if the BIO has not been initialized.</p> <p><code>BIO_new_fd()</code> returns the newly allocated BIO or NULL is an error occurred.</p> <p> </p> <hr /> <h1><a name="examples">EXAMPLES</a></h1> <p>This is a file descriptor BIO version of "Hello World":</p> <pre> BIO *out;</pre> <pre> out = BIO_new_fd(fileno(stdout), BIO_NOCLOSE); BIO_printf(out, "Hello World\n"); BIO_free(out);</pre> <p> </p> <hr /> <h1><a name="see_also">SEE ALSO</a></h1> <p><em>BIO_seek(3)</em>, <em>BIO_tell(3)</em>, <em>BIO_reset(3)</em>, <em>BIO_read_ex(3)</em>, <em>BIO_write_ex(3)</em>, <em>BIO_puts(3)</em>, <em>BIO_gets(3)</em>, <em>BIO_printf(3)</em>, <em>BIO_set_close(3)</em>, <em>BIO_get_close(3)</em></p> <p> </p> <hr /> <h1><a name="copyright">COPYRIGHT</a></h1> <p>Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.</p> <p>Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p> </body> </html>