OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

fd.h
1 /*
2 * Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved.
3 * Copyright (c) 2009 Sandia National Laboratories. All rights reserved.
4 *
5 * $COPYRIGHT$
6 *
7 * Additional copyrights may follow
8 *
9 * $HEADER$
10 */
11
12 /* @file */
13
14 #ifndef OPAL_UTIL_FD_H_
15 #define OPAL_UTIL_FD_H_
16
17 #include "opal_config.h"
18
19 BEGIN_C_DECLS
20
21 /**
22 * Read a complete buffer from a file descriptor.
23 *
24 * @param fd File descriptor
25 * @param len Number of bytes to read
26 * @param buffer Pre-allocated buffer (large enough to hold len bytes)
27 *
28 * @returns OPAL_SUCCESS upon success.
29 * @returns OPAL_ERR_TIMEOUT if the fd closes before reading the full amount.
30 * @returns OPAL_ERR_IN_ERRNO otherwise.
31 *
32 * Loop over reading from the fd until len bytes are read or an error
33 * occurs. EAGAIN and EINTR are transparently handled.
34 */
35 OPAL_DECLSPEC int opal_fd_read(int fd, int len, void *buffer);
36
37 /**
38 * Write a complete buffer to a file descriptor.
39 *
40 * @param fd File descriptor
41 * @param len Number of bytes to write
42 * @param buffer Buffer to write from
43 *
44 * @returns OPAL_SUCCESS upon success.
45 * @returns OPAL_ERR_IN_ERRNO otherwise.
46 *
47 * Loop over writing to the fd until len bytes are written or an error
48 * occurs. EAGAIN and EINTR are transparently handled.
49 */
50 OPAL_DECLSPEC int opal_fd_write(int fd, int len, const void *buffer);
51
52 END_C_DECLS
53
54 #endif