qemu/include/io/channel-util.h
<<
>>
Prefs
   1/*
   2 * QEMU I/O channels utility APIs
   3 *
   4 * Copyright (c) 2016 Red Hat, Inc.
   5 *
   6 * This library is free software; you can redistribute it and/or
   7 * modify it under the terms of the GNU Lesser General Public
   8 * License as published by the Free Software Foundation; either
   9 * version 2.1 of the License, or (at your option) any later version.
  10 *
  11 * This library is distributed in the hope that it will be useful,
  12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14 * Lesser General Public License for more details.
  15 *
  16 * You should have received a copy of the GNU Lesser General Public
  17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  18 *
  19 */
  20
  21#ifndef QIO_CHANNEL_UTIL_H
  22#define QIO_CHANNEL_UTIL_H
  23
  24#include "io/channel.h"
  25
  26/*
  27 * This module provides helper functions that are useful when dealing
  28 * with QIOChannel objects
  29 */
  30
  31
  32/**
  33 * qio_channel_new_fd:
  34 * @fd: the file descriptor
  35 * @errp: pointer to a NULL-initialized error object
  36 *
  37 * Create a channel for performing I/O on the file
  38 * descriptor @fd. The particular subclass of QIOChannel
  39 * that is returned will depend on what underlying object
  40 * the file descriptor is associated with. It may be either
  41 * a QIOChannelSocket or a QIOChannelFile instance. Upon
  42 * success, the returned QIOChannel instance will own
  43 * the @fd file descriptor, and take responsibility for
  44 * closing it when no longer required. On failure, the
  45 * caller is responsible for closing @fd.
  46 *
  47 * Returns: the channel object, or NULL on error
  48 */
  49QIOChannel *qio_channel_new_fd(int fd,
  50                               Error **errp);
  51
  52#endif /* QIO_CHANNEL_UTIL_H */
  53