Blame doc/man3/BIO_s_fd.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
BIO_s_fd, BIO_set_fd, BIO_get_fd, BIO_new_fd - file descriptor BIO
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/bio.h>
Packit c4476c
Packit c4476c
 const BIO_METHOD *BIO_s_fd(void);
Packit c4476c
Packit c4476c
 int BIO_set_fd(BIO *b, int fd, int c);
Packit c4476c
 int BIO_get_fd(BIO *b, int *c);
Packit c4476c
Packit c4476c
 BIO *BIO_new_fd(int fd, int close_flag);
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
BIO_s_fd() returns the file descriptor BIO method. This is a wrapper
Packit c4476c
round the platforms file descriptor routines such as read() and write().
Packit c4476c
Packit c4476c
BIO_read_ex() and BIO_write_ex() read or write the underlying descriptor.
Packit c4476c
BIO_puts() is supported but BIO_gets() is not.
Packit c4476c
Packit c4476c
If the close flag is set then close() is called on the underlying
Packit c4476c
file descriptor when the BIO is freed.
Packit c4476c
Packit c4476c
BIO_reset() attempts to change the file pointer to the start of file
Packit c4476c
such as by using B<lseek(fd, 0, 0)>.
Packit c4476c
Packit c4476c
BIO_seek() sets the file pointer to position B<ofs> from start of file
Packit c4476c
such as by using B<lseek(fd, ofs, 0)>.
Packit c4476c
Packit c4476c
BIO_tell() returns the current file position such as by calling
Packit c4476c
B<lseek(fd, 0, 1)>.
Packit c4476c
Packit c4476c
BIO_set_fd() sets the file descriptor of BIO B to B<fd> and the close
Packit c4476c
flag to B<c>.
Packit c4476c
Packit c4476c
BIO_get_fd() places the file descriptor in B<c> if it is not NULL, it also
Packit c4476c
returns the file descriptor.
Packit c4476c
Packit c4476c
BIO_new_fd() returns a file descriptor BIO using B<fd> and B<close_flag>.
Packit c4476c
Packit c4476c
=head1 NOTES
Packit c4476c
Packit c4476c
The behaviour of BIO_read_ex() and BIO_write_ex() depends on the behavior of the
Packit c4476c
platforms read() and write() calls on the descriptor. If the underlying
Packit c4476c
file descriptor is in a non blocking mode then the BIO will behave in the
Packit c4476c
manner described in the L<BIO_read_ex(3)> and L<BIO_should_retry(3)>
Packit c4476c
manual pages.
Packit c4476c
Packit c4476c
File descriptor BIOs should not be used for socket I/O. Use socket BIOs
Packit c4476c
instead.
Packit c4476c
Packit c4476c
BIO_set_fd() and BIO_get_fd() are implemented as macros.
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
BIO_s_fd() returns the file descriptor BIO method.
Packit c4476c
Packit c4476c
BIO_set_fd() always returns 1.
Packit c4476c
Packit c4476c
BIO_get_fd() returns the file descriptor or -1 if the BIO has not
Packit c4476c
been initialized.
Packit c4476c
Packit c4476c
BIO_new_fd() returns the newly allocated BIO or NULL is an error
Packit c4476c
occurred.
Packit c4476c
Packit c4476c
=head1 EXAMPLES
Packit c4476c
Packit c4476c
This is a file descriptor BIO version of "Hello World":
Packit c4476c
Packit c4476c
 BIO *out;
Packit c4476c
Packit c4476c
 out = BIO_new_fd(fileno(stdout), BIO_NOCLOSE);
Packit c4476c
 BIO_printf(out, "Hello World\n");
Packit c4476c
 BIO_free(out);
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<BIO_seek(3)>, L<BIO_tell(3)>,
Packit c4476c
L<BIO_reset(3)>, L<BIO_read_ex(3)>,
Packit c4476c
L<BIO_write_ex(3)>, L<BIO_puts(3)>,
Packit c4476c
L<BIO_gets(3)>, L<BIO_printf(3)>,
Packit c4476c
L<BIO_set_close(3)>, L<BIO_get_close(3)>
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut