TAPI for some file operations calls

Overview

// typedefs

typedef struct rpc_iovec rpc_iovec;
typedef union rpc_epoll_data rpc_epoll_data_t;

// structs

struct rpc_epoll_event;
struct rpc_f_owner_ex;
struct rpc_iovec;
struct rpc_pollfd;

// unions

union rpc_epoll_data;

// global functions

int rpc_open(rcf_rpc_server* rpcs, const char* path, rpc_fcntl_flags flags, rpc_file_mode_flags mode);
int rpc_open64(rcf_rpc_server* rpcs, const char* path, rpc_fcntl_flags flags, rpc_file_mode_flags mode);
int rpc_mkstemp(rcf_rpc_server* rpcs, const char* template, char** pathname);
int rpc_close(rcf_rpc_server* rpcs, int fd);
ssize_t rpc_write_at_offset(rcf_rpc_server* rpcs, int fd, char* buf, size_t buflen, off_t offset);
int rpc_dup(rcf_rpc_server* rpcs, int oldfd);
int rpc_dup2(rcf_rpc_server* rpcs, int oldfd, int newfd);
int rpc_dup3(rcf_rpc_server* rpcs, int oldfd, int newfd, int flags);
int rpc_write(rcf_rpc_server* rpcs, int fd, const void* buf, size_t count);
int rpc_pwrite(rcf_rpc_server* rpcs, int fd, const void* buf, size_t count, off_t offset);
int rpc_write_via_splice(rcf_rpc_server* rpcs, int fd, const void* buf, size_t count);
int rpc_write_and_close(rcf_rpc_server* rpcs, int fd, const void* buf, size_t count);
tarpc_ssize_t rpc_writebuf_gen(rcf_rpc_server* rpcs, int fd, rpc_ptr buf, size_t buf_off, size_t count);
static tarpc_ssize_t rpc_writebuf(rcf_rpc_server* rpcs, int fd, rpc_ptr buf, size_t count);
static tarpc_ssize_t rpc_writebuf_off(rcf_rpc_server* rpcs, int fd, rpc_ptr_off* buf, size_t count);
int rpc_read_gen(rcf_rpc_server* rpcs, int fd, void* buf, size_t count, size_t rbuflen);
int rpc_read_via_splice(rcf_rpc_server* rpcs, int fd, void* buf, size_t count);
static int rpc_read(rcf_rpc_server* rpcs, int fd, void* buf, size_t count);
int rpc_pread(rcf_rpc_server* rpcs, int fd, void* buf, size_t count, tarpc_off_t offset);
tarpc_ssize_t rpc_readbuf_gen(rcf_rpc_server* rpcs, int fd, rpc_ptr buf, size_t buf_off, size_t count);
static tarpc_ssize_t rpc_readbuf(rcf_rpc_server* rpcs, int fd, rpc_ptr buf, size_t count);
static tarpc_ssize_t rpc_readbuf_off(rcf_rpc_server* rpcs, int fd, rpc_ptr_off* buf, size_t count);
tarpc_off_t rpc_lseek(rcf_rpc_server* rpcs, int fd, tarpc_off_t pos, rpc_lseek_mode mode);
int rpc_truncate(rcf_rpc_server* rpcs, const char* path, tarpc_off_t length);
int rpc_ftruncate(rcf_rpc_server* rpcs, int fd, tarpc_off_t length);
int rpc_fsync(rcf_rpc_server* rpcs, int fd);
uint8_t* rpc_iovec_to_array(size_t len, const struct rpc_iovec* v, size_t cnt);
void te_iovec_rpc2tarpc(const rpc_iovec* rpc_iovs, tarpc_iovec* tarpc_iovs, size_t count);
te_errno te_iovec_rpc2str_append(te_string* str, const rpc_iovec* iovs, size_t count);
int rpc_iovec_cmp(size_t v1len, const struct rpc_iovec* v1, size_t v1cnt, size_t v2len, const struct rpc_iovec* v2, size_t v2cnt);
void rpc_iovec_cmp_strict(rpc_iovec* iov1, rpc_iovec* iov2, size_t iovcnt);
int rpc_writev(rcf_rpc_server* rpcs, int fd, const struct rpc_iovec* iov, size_t iovcnt);
int rpc_pwritev(rcf_rpc_server* rpcs, int fd, const struct rpc_iovec* iov, size_t iovcnt, tarpc_off_t offset);
int rpc_pwritev2(rcf_rpc_server* rpcs, int fd, const struct rpc_iovec* iov, size_t iovcnt, tarpc_off_t offset, rpc_preadv2_pwritev2_flags flags);
int rpc_readv_gen(rcf_rpc_server* rpcs, int fd, const struct rpc_iovec* iov, size_t iovcnt, size_t riovcnt);
static int rpc_readv(rcf_rpc_server* rpcs, int fd, const struct rpc_iovec* iov, size_t iovcnt);
int rpc_preadv(rcf_rpc_server* rpcs, int fd, const struct rpc_iovec* iov, size_t iovcnt, tarpc_off_t offset);
int rpc_preadv2(rcf_rpc_server* rpcs, int fd, const struct rpc_iovec* iov, size_t iovcnt, tarpc_off_t offset, rpc_preadv2_pwritev2_flags flags);
rpc_fd_set_p rpc_fd_set_new(rcf_rpc_server* rpcs);
void rpc_fd_set_delete(rcf_rpc_server* rpcs, rpc_fd_set_p set);
void rpc_do_fd_zero(rcf_rpc_server* rpcs, rpc_fd_set_p set);
void rpc_do_fd_set(rcf_rpc_server* rpcs, int fd, rpc_fd_set_p set);
void rpc_do_fd_clr(rcf_rpc_server* rpcs, int fd, rpc_fd_set_p set);
int rpc_do_fd_isset(rcf_rpc_server* rpcs, int fd, rpc_fd_set_p set);
int rpc_select(rcf_rpc_server* rpcs, int n, rpc_fd_set_p readfds, rpc_fd_set_p writefds, rpc_fd_set_p exceptfds, struct tarpc_timeval* timeout);
int rpc_pselect(rcf_rpc_server* rpcs, int n, rpc_fd_set_p readfds, rpc_fd_set_p writefds, rpc_fd_set_p exceptfds, struct tarpc_timespec* timeout, const rpc_sigset_p sigmask);
int rpc_epoll_create(rcf_rpc_server* rpcs, int size);
int rpc_epoll_create1(rcf_rpc_server* rpcs, int flags);
int rpc_epoll_ctl(rcf_rpc_server* rpcs, int epfd, int oper, int fd, struct rpc_epoll_event* event);
static int rpc_epoll_ctl_simple(rcf_rpc_server* rpcs, int epfd, int oper, int fd, uint32_t events);
int rpc_epoll_wait_gen(rcf_rpc_server* rpcs, int epfd, struct rpc_epoll_event* events, int rmaxev, int maxevents, int timeout);
static int rpc_epoll_wait(rcf_rpc_server* rpcs, int epfd, struct rpc_epoll_event* events, int maxevents, int timeout);
int rpc_epoll_pwait_gen(rcf_rpc_server* rpcs, int epfd, struct rpc_epoll_event* events, int rmaxev, int maxevents, int timeout, const rpc_sigset_p sigmask);
static int rpc_epoll_pwait(rcf_rpc_server* rpcs, int epfd, struct rpc_epoll_event* events, int maxevents, int timeout, const rpc_sigset_p sigmask);
int rpc_epoll_pwait2_gen(rcf_rpc_server* rpcs, int epfd, struct rpc_epoll_event* events, int rmaxev, int maxevents, struct tarpc_timespec* timeout, const rpc_sigset_p sigmask);
static int rpc_epoll_pwait2(rcf_rpc_server* rpcs, int epfd, struct rpc_epoll_event* events, int maxevents, struct tarpc_timespec* timeout, const rpc_sigset_p sigmask);
int rpc_poll_gen(rcf_rpc_server* rpcs, struct rpc_pollfd* ufds, unsigned int nfds, int timeout, unsigned int rnfds);
static int rpc_poll(rcf_rpc_server* rpcs, struct rpc_pollfd* ufds, unsigned int nfds, int timeout);
int rpc_ppoll_gen(rcf_rpc_server* rpcs, struct rpc_pollfd* ufds, unsigned int nfds, struct tarpc_timespec* timeout, const rpc_sigset_p sigmask, unsigned int rnfds);
static int rpc_ppoll(rcf_rpc_server* rpcs, struct rpc_pollfd* ufds, unsigned int nfds, struct tarpc_timespec* timeout, const rpc_sigset_p sigmask);
ssize_t rpc_sendfile(rcf_rpc_server* rpcs, int out_fd, int in_fd, tarpc_off_t* offset, size_t count, tarpc_bool force64);
ssize_t rpc_sendfile_via_splice(rcf_rpc_server* rpcs, int out_fd, int in_fd, tarpc_off_t* offset, size_t count);
ssize_t rpc_splice(rcf_rpc_server* rpcs, int fd_in, tarpc_off_t* off_in, int fd_out, tarpc_off_t* off_out, size_t len, int flags);
int rpc_ioctl(rcf_rpc_server* rpcs, int fd, rpc_ioctl_code request, ...);
int rpc_fcntl(rcf_rpc_server* rpcs, int fd, int cmd, ...);
int rpc_pipe(rcf_rpc_server* rpcs, int filedes[2]);
int rpc_pipe2(rcf_rpc_server* rpcs, int filedes[2], int flags);
int rpc_socketpair(rcf_rpc_server* rpcs, rpc_socket_domain domain, rpc_socket_type type, rpc_socket_proto protocol, int sv[2]);
void rpc_exit(rcf_rpc_server* rpcs, int status);
void rpc__exit(rcf_rpc_server* rpcs, int status);
pid_t rpc_getpid(rcf_rpc_server* rpcs);
tarpc_pthread_t rpc_pthread_self(rcf_rpc_server* rpcs);
int rpc_pthread_cancel(rcf_rpc_server* rpcs, tarpc_pthread_t tid);
int rpc_pthread_setcancelstate(rcf_rpc_server* rpcs, rpc_pthread_cancelstate state, rpc_pthread_cancelstate* oldstate);
int rpc_pthread_setcanceltype(rcf_rpc_server* rpcs, rpc_pthread_canceltype type, rpc_pthread_canceltype* oldtype);
int rpc_pthread_join(rcf_rpc_server* rpcs, tarpc_pthread_t tid, uint64_t* retval);
int rpc_gettid(rcf_rpc_server* rpcs);
tarpc_uid_t rpc_getuid(rcf_rpc_server* rpcs);
int rpc_setuid(rcf_rpc_server* rpcs, tarpc_uid_t uid);
int rpc_access(rcf_rpc_server* rpcs, const char* path, int mode);
struct passwd* rpc_getpwnam(rcf_rpc_server* rpcs, const char* name);
int rpc_uname(rcf_rpc_server* rpcs, struct utsname* buf);
tarpc_uid_t rpc_geteuid(rcf_rpc_server* rpcs);
int rpc_seteuid(rcf_rpc_server* rpcs, tarpc_uid_t uid);
rpc_ptr rpc_malloc(rcf_rpc_server* rpcs, size_t size);
void rpc_free(rcf_rpc_server* rpcs, rpc_ptr buf);
uint64_t rpc_get_addr_by_id(rcf_rpc_server* rpcs, rpc_ptr id);
static bool rpc_malloc_off(rcf_rpc_server* rpcs, size_t size, rpc_ptr_off** buf);
static void rpc_free_off(rcf_rpc_server* rpcs, rpc_ptr_off* buf);
rpc_ptr rpc_malloc_misaligned(rcf_rpc_server* rpcs, size_t alignment, size_t size, size_t offset);
int rpc_posix_memalign(rcf_rpc_server* rpcs, rpc_ptr* ptr, size_t alignment, size_t size);
int rpc_setrlimit(rcf_rpc_server* rpcs, int resource, const tarpc_rlimit* rlim);
int rpc_getrlimit(rcf_rpc_server* rpcs, int resource, tarpc_rlimit* rlim);
int64_t rpc_sysconf(rcf_rpc_server* rpcs, rpc_sysconf_name name);
int rpc_fstat(rcf_rpc_server* rpcs, int fd, rpc_stat* buf);
int rpc_fstat64(rcf_rpc_server* rpcs, int fd, rpc_stat* buf);
int rpc_stat_func(rcf_rpc_server* rpcs, const char* path, rpc_stat* buf);
int rpc_link(rcf_rpc_server* rpcs, const char* path1, const char* path2);
int rpc_symlink(rcf_rpc_server* rpcs, const char* path1, const char* path2);
ssize_t rpc_readlink(rcf_rpc_server* rpcs, const char* path, char* buf, size_t bufsize);
int rpc_unlink(rcf_rpc_server* rpcs, const char* path);
int rpc_mkdir(rcf_rpc_server* rpcs, const char* path, rpc_file_mode_flags mode);
int rpc_mkdirp(rcf_rpc_server* rpcs, const char* path, rpc_file_mode_flags mode);
int rpc_rmdir(rcf_rpc_server* rpcs, const char* path);
int rpc_rename(rcf_rpc_server* rpcs, const char* path_old, const char* path_new);
int rpc_fstatvfs(rcf_rpc_server* rpcs, int fd, tarpc_statvfs* buf);
int rpc_statvfs(rcf_rpc_server* rpcs, const char* path, tarpc_statvfs* buf);
int rpc_gethostname(rcf_rpc_server* rpcs, char* name, size_t len);
int rpc_chroot(rcf_rpc_server* rpcs, char* path);
int rpc_copy_ta_libs(rcf_rpc_server* rpcs, char* path);
int rpc_rm_ta_libs(rcf_rpc_server* rpcs, char* path);
int rpc_execve_gen(rcf_rpc_server* rpcs, const char* filename, char*const argv[], char*const envp[]);
void rpc_make_iov(rpc_iovec* iov, size_t iovcnt, size_t min, size_t max);
void rpc_release_iov(rpc_iovec* iov, size_t iovcnt);
void rpc_alloc_iov(rpc_iovec** iov, size_t iovcnt, size_t min, size_t max);
void rpc_free_iov(rpc_iovec* iov, size_t iovcnt);
uint8_t* rpc_iov_append2dbuf(const rpc_iovec* iov, size_t iovcnt, te_dbuf* buf);
uint8_t* rpc_iov2dbuf(const rpc_iovec* iov, size_t iovcnt, te_dbuf* buf);
size_t rpc_iov_data_len(const rpc_iovec* iov, size_t iovcnt);

// macros

#define CLEANUP_RPC_FREE(_rpcs, _ptr)

Detailed Documentation

Typedefs

typedef struct rpc_iovec rpc_iovec

Sturcture to store vector of buffers

Global Functions

int rpc_open(rcf_rpc_server* rpcs, const char* path, rpc_fcntl_flags flags, rpc_file_mode_flags mode)

Open a file or device.

Parameters:

rpcs

RPC server handle

path

File or device name

flags

How to open

mode

The permissions to use in case a new file is created

Returns:

File descriptor on success or -1 on failure

int rpc_open64(rcf_rpc_server* rpcs, const char* path, rpc_fcntl_flags flags, rpc_file_mode_flags mode)

Open a large file or device.

Parameters:

rpcs

RPC server handle

path

File or device name

flags

How to open

mode

The permissions to use in case a new file is created

Returns:

File descriptor on success or -1 on failure

int rpc_mkstemp(rcf_rpc_server* rpcs, const char* template, char** pathname)

Create and open a temporary file.

Parameters:

rpcs

RPC server handle.

template

Template for a pathname. Like for the POSIX mkstemp(), it must end with six XXXXXX, but unlike mkstemp(), the value won’t be modified.

pathname

The location for a generated name (may be NULL, otherwise the memory should be free()’d).

Returns:

File descriptor or -1 on failure

int rpc_close(rcf_rpc_server* rpcs, int fd)

Close file descriptor on RPC server side.

Parameters:

rpcs

RPC server handle

fd

file descriptor to close

Returns:

0 on success or -1 on failure

ssize_t rpc_write_at_offset(rcf_rpc_server* rpcs, int fd, char* buf, size_t buflen, off_t offset)

Write the buffer to the file starting with the specified file offset.

Parameters:

rpcs

RPC server handle

fd

file descriptor

buf

buffer to write

buflen

size of buffer

offset

file offset to write the buffer at

-2

Failed to reposition the file offset.

-1

Failed to write the data.

-3

Other errors.

Returns:

Number of bytes actually written or negative value on failure.

int rpc_dup(rcf_rpc_server* rpcs, int oldfd)

Duplicate a file descriptor on RPC server side.

See dup manual page for more information

Parameters:

rpcs

RPC server handle

oldfd

file descriptor to be duplicated

Returns:

New file descriptor or -1 on error

int rpc_dup2(rcf_rpc_server* rpcs, int oldfd, int newfd)

Duplicate an open file descriptor on RPC server side.

See dup2 manual page for more information

Parameters:

rpcs

RPC server handle

oldfd

file descriptor to be duplicated

newfd

new file descriptor

Returns:

New file descriptor or -1 when an error occurred.

int rpc_dup3(rcf_rpc_server* rpcs, int oldfd, int newfd, int flags)

Duplicate an open file descriptor on RPC server side.

See dup3 manual page for more information

Parameters:

rpcs

RPC server handle

oldfd

file descriptor to be duplicated

newfd

new file descriptor

flags

RPC_O_CLOEXEC flag

Returns:

New file descriptor or -1 when an error occurred.

int rpc_write(rcf_rpc_server* rpcs, int fd, const void* buf, size_t count)

Write up to count bytes from buffer buf to file with descriptor fd. See write(2) manual page for more information

Parameters:

rpcs

RPC server handle

fd

file descriptor

buf

pointer to a buffer containing data to write

count

number of bytes to be written

Returns:

Number of bytes actually written, otherwise -1 on failure

int rpc_pwrite(rcf_rpc_server* rpcs, int fd, const void* buf, size_t count, off_t offset)

Write up to count bytes from buffer buf to a file with descriptor fd at offset. See pwrite(2) manual page for more information.

Parameters:

rpcs

RPC server handle.

fd

File descriptor.

buf

Pointer to a buffer containing data to write.

count

Number of bytes to be written.

offset

Offset from the start of the fd.

Returns:

Number of bytes actually written, otherwise -1 on failure.

int rpc_write_and_close(rcf_rpc_server* rpcs, int fd, const void* buf, size_t count)

Write up to count bytes from buffer buf to file with descriptor fd and close this file descriptor.

Parameters:

rpcs

RPC server handle

fd

file descriptor

buf

pointer to a buffer containing data to write

count

number of bytes to be written

Returns:

Number of bytes actually written, otherwise -1 on failure

tarpc_ssize_t rpc_writebuf_gen(rcf_rpc_server* rpcs, int fd, rpc_ptr buf, size_t buf_off, size_t count)

Like rpc_write(), but uses a buffer that has been allocated by the user earlier.

Parameters:

rpcs

RPC server handle

fd

file descriptor

buf

pointer to the data buffer in the TA address space

count

number of bytes to be written

Returns:

Number of bytes actually written, otherwise -1 on failure

int rpc_read_gen(rcf_rpc_server* rpcs, int fd, void* buf, size_t count, size_t rbuflen)

This generic routine attemps to read up to count bytes from file with descriptor fdinto buffer pointed by buf. The behavior of this call depends on the following operations

  • RCF_RPC_CALL do not wait the remote procedure to complete (non-blocking call)

  • RCF_RPC_WAIT wait for non-blocking call to complete

  • RCF_RPC_CALL_WAIT wait for remote procedure to complete before returning (blocking call)

Parameters:

rpcs

RPC server handle

fd

file descriptor

buf

pointer to buffer into where data is read

count

number of bytes to read

rbuflen

real size of the buffer to be copied by RPC

Returns:

Number of bytes read, otherwise -1 on error.

static int rpc_read(rcf_rpc_server* rpcs, int fd, void* buf, size_t count)

Attemp to read up to count bytes from file with descriptor fd into buffer pointed by buf. The behavior of this call depends on the following operations

  • RCF_RPC_CALL do not wait the remote procedure to complete (non-blocking call)

  • RCF_RPC_WAIT wait for non-blocking call to complete

  • RCF_RPC_CALL_WAIT wait for remote procedure to complete before returning (blocking call)

Parameters:

rpcs

RPC server handle

fd

file descriptor

buf

pointer to buffer into where data is read

count

number of bytes to read

Returns:

number of bytes read, otherwise -1 on error.

int rpc_pread(rcf_rpc_server* rpcs, int fd, void* buf, size_t count, tarpc_off_t offset)

Read up to count bytes from file with descriptor fd at offset into buffer pointed to by buf. The behavior of this call depends on the following operations:

  • RCF_RPC_CALL do not wait the remote procedure to complete (non-blocking call)

  • RCF_RPC_WAIT wait for non-blocking call to complete

  • RCF_RPC_CALL_WAIT wait for remote procedure to complete before returning (blocking call)

Parameters:

rpcs

RPC server handle.

fd

File descriptor.

buf

Pointer to buffer into where data is read.

count

Number of bytes to read.

offset

Offset from the start of the fd.

Returns:

Number of bytes read, otherwise -1 on error.

tarpc_ssize_t rpc_readbuf_gen(rcf_rpc_server* rpcs, int fd, rpc_ptr buf, size_t buf_off, size_t count)

Like rpc_read() but uses a buffer allocated by the user on the TA earlier.

Parameters:

rpcs

RPC server handle

fd

file descriptor

buf

pointer to buffer into where data is read

count

number of bytes to read

Returns:

number of bytes read, otherwise -1 on error.

tarpc_off_t rpc_lseek(rcf_rpc_server* rpcs, int fd, tarpc_off_t pos, rpc_lseek_mode mode)

RPC equivalent of ‘lseek’

Parameters:

rpcs

RPC server handle

fd

file descriptor

pos

position to seek

count

seek mode (SEEK_SET, SEEK_CUR, SEEK_END)

Returns:

Resuling file position or -1 on error

int rpc_fsync(rcf_rpc_server* rpcs, int fd)

RPC equivalent of ‘fsync’

Parameters:

rpcs

RPC server handle

fd

file descriptor

Returns:

0 on success, -1 on failure

uint8_t* rpc_iovec_to_array(size_t len, const struct rpc_iovec* v, size_t cnt)

Convert I/O vector to array.

Parameters:

len

total data length

v

I/O vector

cnt

number of elements in vector

Returns:

Pointer to allocated array or NULL.

void te_iovec_rpc2tarpc(const rpc_iovec* rpc_iovs, tarpc_iovec* tarpc_iovs, size_t count)

Fill array of tarpc_iovec structures with data from array of rpc_iovec structures before passing it to an RPC call.

Parameters:

rpc_iovs

Array of rpc_iovec structures.

tarpc_iovs

Array of tarpc_iovec structures.

count

Number of elements in the arrays.

te_errno te_iovec_rpc2str_append(te_string* str, const rpc_iovec* iovs, size_t count)

Append string representation of a given array of rpc_iovec structures to TE string.

Parameters:

str

Pointer to TE string.

iovs

Array of rpc_iovec structures.

count

Number of elements in the array.

Returns:

Status code.

int rpc_iovec_cmp(size_t v1len, const struct rpc_iovec* v1, size_t v1cnt, size_t v2len, const struct rpc_iovec* v2, size_t v2cnt)

Compare RPC alalog of ‘struct iovec’.

Parameters:

v1len

total length of the first vector

v1

the first vector

v1cnt

number of buffers in vector v1

v2len

total length of the second vector

v2

the second vector

v2cnt

number of buffers in vector v1

Returns:

0 on success or -1 on failure

void rpc_iovec_cmp_strict(rpc_iovec* iov1, rpc_iovec* iov2, size_t iovcnt)

Strictly compare two iov vectors. Buffers length and data have to be equal.

The function jumps to cleanup with a verdict if buffers are different.

Parameters:

iov1

The first iov vectors array.

iov2

The second iov vectors array.

len

Arrays length.

int rpc_writev(rcf_rpc_server* rpcs, int fd, const struct rpc_iovec* iov, size_t iovcnt)

Write data to file with descriptor fd from the specified vector of buffer.

See writev manual page for more information

Parameters:

rpcs

RPC server handle

fd

file descriptor

iov

vector of buffers to be written.

iovcnt

number of buffers

Returns:

Number of bytes really written, otherwise -1 is returned on error

int rpc_pwritev(rcf_rpc_server* rpcs, int fd, const struct rpc_iovec* iov, size_t iovcnt, tarpc_off_t offset)

Write data to file with descriptor fd at offset from the specified vector of buffer.

See pwritev manual page for more information.

Parameters:

rpcs

RPC server handle.

fd

File descriptor.

iov

Vector of buffers to be written.

iovcnt

Number of buffers.

offset

Offset from the start of the fd.

Returns:

Number of bytes really written, otherwise -1 is returned on error.

int rpc_pwritev2(rcf_rpc_server* rpcs, int fd, const struct rpc_iovec* iov, size_t iovcnt, tarpc_off_t offset, rpc_preadv2_pwritev2_flags flags)

Write data to file with descriptor fd at offset from the specified vector of buffer.

See pwritev2 manual page for more information

Parameters:

rpcs

RPC server handle

fd

file descriptor

iov

vector of buffers to be written.

iovcnt

number of buffers

offset

offset from the start of the fd

flags

specifies bits for per-call operation

Returns:

Number of bytes really written, otherwise -1 is returned on error

int rpc_readv_gen(rcf_rpc_server* rpcs, int fd, const struct rpc_iovec* iov, size_t iovcnt, size_t riovcnt)

Read data from specified file with descriptor fd into a vector of buffer iov.

See readv manual page for more information

Parameters:

rpcs

RPC server handle

fd

file descriptorfrom which data is read

iov

vector of buffer where data is stored

iovcnt

number of buffer to read

riovcnt

real number of buffer

Returns:

Number of bytes read,otherwise -1 is returned when an error occurred.

static int rpc_readv(rcf_rpc_server* rpcs, int fd, const struct rpc_iovec* iov, size_t iovcnt)

Attempt to read data from specified file with descriptor fd into a vector of buffer iov.

See readv manual page for more information

Parameters:

rpcs

RPC server handle

fd

file descriptorfrom which data is read

iov

vector of buffer where data is stored

iovcnt

number of buffer to read

Returns:

Number of bytes read,otherwise -1 is returned when an error occurred.

int rpc_preadv(rcf_rpc_server* rpcs, int fd, const struct rpc_iovec* iov, size_t iovcnt, tarpc_off_t offset)

Read data from specified file with descriptor fd at offset into a vector of buffer iov.

See preadv manual page for more information.

Parameters:

rpcs

RPC server handle.

fd

File descriptorfrom which data is read.

iov

Vector of buffer where data is stored.

iovcnt

Number of buffer to read.

offset

Offset from the start of the fd.

Returns:

Number of bytes read,otherwise -1 is returned when an error occurred.

int rpc_preadv2(rcf_rpc_server* rpcs, int fd, const struct rpc_iovec* iov, size_t iovcnt, tarpc_off_t offset, rpc_preadv2_pwritev2_flags flags)

Read data with flags from specified file with descriptor fd at offset into a vector of buffer iov.

See preadv manual page for more information

Parameters:

rpcs

RPC server handle

fd

file descriptorfrom which data is read

iov

vector of buffer where data is stored

iovcnt

number of buffer to read

offset

offset from the start of the fd

flags

specifies bits for per-call operation

Returns:

Number of bytes read,otherwise -1 is returned when an error occurred.

rpc_fd_set_p rpc_fd_set_new(rcf_rpc_server* rpcs)

Allocate a set of file descriptors on RPC server side.

Parameters:

rpcs

RPC server handle

Returns:

Set of descriptors,otherwise NULL is returned on error

void rpc_fd_set_delete(rcf_rpc_server* rpcs, rpc_fd_set_p set)

Destroy a specified set of file descriptors allocated by rpc_fd_set_new.

Parameters:

rpcs

RPC server handle

set

set of descriptors to be deleted

void rpc_do_fd_zero(rcf_rpc_server* rpcs, rpc_fd_set_p set)

Initialize the specified set of descriptors (clear the set)

Parameters:

rpcs

RPC server handle

set

set of descriptors to initialize

void rpc_do_fd_set(rcf_rpc_server* rpcs, int fd, rpc_fd_set_p set)

Add a specified descriptor fd to a given set of descriptors set on RPC server side.

Parameters:

rpcs

RPC server handle

fd

descriptor to add to the set

set

set to which descriptor is added

void rpc_do_fd_clr(rcf_rpc_server* rpcs, int fd, rpc_fd_set_p set)

Remove a specified descriptor from the set of descriptors.

Parameters:

rpcs

RPC server handle

fd

descriptor to remove

set

set from which descriptor is removed

int rpc_do_fd_isset(rcf_rpc_server* rpcs, int fd, rpc_fd_set_p set)

Test existance of specified descriptor fd in a given set of descriptor set.

Parameters:

rpcs

RPC server handle

fd

descriptor to test

set

set of descriptor

Returns:

Value other than zero, other return 0 when failed.

int rpc_select(rcf_rpc_server* rpcs, int n, rpc_fd_set_p readfds, rpc_fd_set_p writefds, rpc_fd_set_p exceptfds, struct tarpc_timeval* timeout)

Examine the file descriptor sets whose addresses are passed in the readfds, writefds, and exceptfds parameters to see whether some of there file descriptors are ready for reading, writing or have and exceptional condition pending, respectively. The behavior of this routine depends on specified RPC operation: RCF_RPC_CALL - return immediately without waiting for remote procedure to complete (non-blocking call). RCF_RPC_WAIT - wait for non-blocking call to complete RCF_RPC_CALL_WAIT - wait for remote procedure to complete before returning (blocking call)

Parameters:

rpcs

RPC server handle

n

range of descriptors to be tested. The first n descriptors should be checked in each defined set. That is the descriptors from 0 to n-1 shall be examined.

readfds

checked file descrpitors for readability

writefds

checked file descriptors for writing

exceptfds

checked file descriptors for exceptional conditions

timeout

upper bound of time elapsed before remote select procedure return.

Returns:

Total number of file descriptors contained in the whole defined set upon successful completion, which may be zero if the timeout expires before anything interesting happens, otherwise -1 is returned.

int rpc_pselect(rcf_rpc_server* rpcs, int n, rpc_fd_set_p readfds, rpc_fd_set_p writefds, rpc_fd_set_p exceptfds, struct tarpc_timespec* timeout, const rpc_sigset_p sigmask)

Examine the file descriptor sets whose addresses are passed in the readfds, writefds, and exceptfds parameters to see whether some of there file descriptors are ready for reading, writing or have and exceptional condition pending, respectively. The current signal mask is replaced by the one pointed by sigmask, and restoted after select call. The behavior of this routine depends on specified RPC operation: RCF_RPC_CALL - return immediately without waiting for remote procedure to complete (non-blocking call). RCF_RPC_WAIT - wait for non-blocking call to complete RCF_RPC_CALL_WAIT - wait for remote procedure to complete before returning (blocking call)

See pselect manual page for more information

Parameters:

rpcs

RPC server handle

n

Range of descriptors to be tested. The first n descriptors should be checked in each defined set. That is the descriptors from 0 to n-1 shall be examined.

readfds

checked file descrpitors for readability

writefds

checked file descriptors for writing possibility

exceptfds

checked fie descriptors for exceptional conditions

timeout

Upper bound of time elapsed before remote select procedure return.

sigmask

Pointer to a signal mask (See sigprocmask(2))

Returns:

Total number of file descriptors contained in the whole defined set upon successful completion, which may be zero if the timeout expires before anything interesting happens, otherwise -1 is returned.

int rpc_poll_gen(rcf_rpc_server* rpcs, struct rpc_pollfd* ufds, unsigned int nfds, int timeout, unsigned int rnfds)

Provide a generic mechanism for reporting I/O conditions associated with a set of file descriptors and waiting for one or more specified conditions becomes true. Specified condition include the ability to read or write data without blocking and error conditions;

Parameters:

rpcs

RPC server handle

ufds

pointer to an array of rpc_pollfd structure. One for each file descriptor of interest.

nfds

number of rpc_pollfd in the array of rpc_pollfd structure

timeout

maximum length of time(in milliseconds) to wait before at least one of the specified condition occures. A negative value means an infinite timeout.

rnfds

real size of the array of rpc_pollfd structures

Returns:

A positive number is returned upon successful completion. That’s the number of rpc_pollfd structure that have non-zero revents fields. A value of zero indicates that the timed out and no file descriptors have been selcted. -1 is returned on error.

static int rpc_poll(rcf_rpc_server* rpcs, struct rpc_pollfd* ufds, unsigned int nfds, int timeout)

Provide a mechanism for reporting I/O conditions associated with a set of file descriptors and waiting for one or more specified conditions becomes true. Specified condition include the ability to read or write data without blocking and error conditions;

See poll manual page for more information

Parameters:

rpcs

RPC server handle

ufds

pointer to an array of rpc_pollfd structure. One for each file descriptor of interest.

nfds

number of rpc_pollfd in the array of rpc_pollfd strudture

timeout

maximum length of time(in milliseconds) to wait before at least one of the specified condition occures. A negative value means an infinite timeout.

Returns:

A positive number is returned upon successful completion. That’s the number of rpc_pollfd structure that have non-zero revents fields. A value of zero indicates that the timed out and no file descriptors have been selcted. -1 is returned on error.

ssize_t rpc_sendfile(rcf_rpc_server* rpcs, int out_fd, int in_fd, tarpc_off_t* offset, size_t count, tarpc_bool force64)

Routine which copies data from file descriptor opened for reading to the file descriptor opened for writing (processing in kernel land).

Parameters:

rpcs

RPC server

out_fd

file descriptor opened for writing

in_fd

file descriptor opened for reading

offset

pointer to input file pointer position

count

number of bytes to copy between file descriptors

force64

boolean value, whether to force sendfile64 call

Returns:

Number of bytes written to out_fd or -1 in the case of failure and appropriate errno

int rpc_ioctl(rcf_rpc_server* rpcs, int fd, rpc_ioctl_code request, ...)

Manipulate the underlying device parameters of special files. In particular many operating characteristics of character special files may be controlled with rpc_ioctl request. The argument fd must be an opened file descriptor.

See ioctl manual page for more information

Parameters:

rpcs

RPC server handle

fd

opened file descriptor

request

request code (See te_rpc_sys_socket.h for availlable request codes)

optional parameter for request specific information

Returns:

Zero on success. Some ioctls use the returned value as an output parameter and return a non negative value on success. -1 is returned on error.

int rpc_fcntl(rcf_rpc_server* rpcs, int fd, int cmd, ...)

Perform various miscellaneous operation on files descriptor fd. The operation in question is determined by cmd

Parameters:

rpcs

RPC server handle

fd

opened file descriptor

cmd

command that indicate the requested operation See te_rpc_fcntl.h for availlable command.

arg

indicate flag used according to cmd

Returns:

The returned value depends on the specified operation See fcntl manual page for more information.

int rpc_pipe(rcf_rpc_server* rpcs, int filedes[2])

Create a pair file descriptor on RPC server side, pointing to a pipe inode and place them in the array filedes The file descriptor of index zero (filedes[0]) is used for reading, and the other file descriptor for writing.

Parameters:

rpcs

RPC server handle

filedes

array of created file descriptors

Returns:

Upon successful completion this function returns 0. On error -1 is returned.

int rpc_pipe2(rcf_rpc_server* rpcs, int filedes[2], int flags)

Create a pair file descriptor on RPC server side, pointing to a pipe inode and place them in the array filedes The file descriptor of index zero (filedes[0]) is used for reading, and the other file descriptor for writing.

Parameters:

rpcs

RPC server handle

filedes

array of created file descriptors

flags

RPC_O_NONBLOCK, RPC_O_CLOEXEC flags

Returns:

Upon successful completion this function returns 0. On error -1 is returned.

int rpc_socketpair(rcf_rpc_server* rpcs, rpc_socket_domain domain, rpc_socket_type type, rpc_socket_proto protocol, int sv[2])

Create a unnamed pair of connected socket on RPC server side. the sockets belong to specified domain domain, and are of specified type type. The descriptor used in referencing the new sockets are returned in sv[0] and sv[1].

See socketpair manual page for more information

Parameters:

rpcs

RPC server handle

domain

communication domain

type

defines semantic of communication

protocol

specifies the protocol to be used.

sv

array of file descriptors

Returns:

0 is returned upon successful completion, otherwise -1 is returned.

void rpc_exit(rcf_rpc_server* rpcs, int status)

Terminate RPC server process via exit() call.

Parameters:

rpcs

RPC server handle

status

Status code

void rpc__exit(rcf_rpc_server* rpcs, int status)

Terminate RPC server process via _exit() call.

Parameters:

rpcs

RPC server handle

status

Status code

pid_t rpc_getpid(rcf_rpc_server* rpcs)

Get RPC server process identification.

Parameters:

rpcs

RPC server handle

Returns:

The ID of the RPC server process

tarpc_pthread_t rpc_pthread_self(rcf_rpc_server* rpcs)

Get RPC server thread identification.

Parameters:

rpcs

RPC server handle

Returns:

The thread ID of the RPC server thread

int rpc_pthread_cancel(rcf_rpc_server* rpcs, tarpc_pthread_t tid)

Send a cancellation request to a RPC thread.

Parameters:

rpcs

RPC server handle

tid

The thread ID

Returns:

0 is returned upon successful completion, otherwise -1 is returned.

int rpc_pthread_setcancelstate(rcf_rpc_server* rpcs, rpc_pthread_cancelstate state, rpc_pthread_cancelstate* oldstate)

Set cancelability state to a RPC thread.

Parameters:

rpcs

RPC server handle

state

State to set

oldstate

Old state of the thread cancelability, can be NULL if does not matter

Returns:

0 is returned upon successful completion, otherwise -1 is returned.

int rpc_pthread_setcanceltype(rcf_rpc_server* rpcs, rpc_pthread_canceltype type, rpc_pthread_canceltype* oldtype)

Set cancelability type to a RPC thread.

Parameters:

rpcs

RPC server handle

type

Type to set

oldtype

Old type of the thread cancelability, can be NULL if does not matter

Returns:

0 is returned upon successful completion, otherwise -1 is returned.

int rpc_pthread_join(rcf_rpc_server* rpcs, tarpc_pthread_t tid, uint64_t* retval)

Join with a terminated thread

Parameters:

rpcs

RPC server handle

tid

The thread ID

retval

Exit status of the target thread, can be NULL if does not matter

Returns:

0 is returned upon successful completion, otherwise -1 is returned.

int rpc_gettid(rcf_rpc_server* rpcs)

Get thread ID. This is linux-specific system call.

Parameters:

rpcs

RPC server handle

Returns:

0 on success or -1 on failure

tarpc_uid_t rpc_getuid(rcf_rpc_server* rpcs)

Query the real user ID on the RPC server.

Parameters:

rpcs

RPC server handle

Returns:

The real user ID

int rpc_setuid(rcf_rpc_server* rpcs, tarpc_uid_t uid)

Set the effective user ID of the RPC server process. If the effective user ID is root, then the real and saved user ID’s are also set. Under Linux setuid is implemented like POSIX version with _POSIX_SAVED_IDS future. This allows a setuid program to drop all of its user privileges, do some un-privileged work, and then re-engage the original user ID for secure manner

See setuid manual page for more information

Parameters:

rpcs

RPC server handle

uid

user ID

Returns:

Upon successful completion returns 0, otherwise -1 is returned.

int rpc_access(rcf_rpc_server* rpcs, const char* path, int mode)

Checks for access permissions mode of path at rpcs

Parameters:

rpcs

RPC server handle

path

Pathname to check

mode

Access mode (see lib/rpc_types/te_rpc_sys_stat.h)

Returns:

0 if path is available as specific mode, -1 otherwise

struct passwd* rpc_getpwnam(rcf_rpc_server* rpcs, const char* name)

Query information about the broken out fields of a line from /etc/passwd for the entry that matches the user name name on RPC server side

Parameters:

rpcs

RPC server handle

name

user name whose information is needed.

Returns:

Upon successful completion a pointer to a structure containing the broken out fields, otherwise a NULL pointer is returned.

int rpc_uname(rcf_rpc_server* rpcs, struct utsname* buf)

Query information about the host on RPC server site

Parameters:

rpcs

RPC server handle

buf

Buffer to hold host info (OUT)

Returns:

0 in case of success, -1 in case of error

tarpc_uid_t rpc_geteuid(rcf_rpc_server* rpcs)

Get the effective user ID of the RPC server process. The effective user ID corresponds to the set ID bit of the file currently executed.

Parameters:

rpcs

RPC server handle

Returns:

The effective user ID of the RPC server process

int rpc_seteuid(rcf_rpc_server* rpcs, tarpc_uid_t uid)

Set the effective user ID of the RPC server process. Unprivileged user processes can only set the effective user ID to the real user ID, the effective user ID, or the saved user ID.

Parameters:

rpcs

RPC server handle

uid

User ID to be set

Returns:

Upon successful completion this function returns 0, otherwise -1 is returned.

rpc_ptr rpc_malloc(rcf_rpc_server* rpcs, size_t size)

Allocate a buffer of specified size in the TA address space.

Parameters:

rpcs

RPC server handle

size

size of the buffer to be allocated

Returns:

Allocated buffer identifier or RPC_NULL.

void rpc_free(rcf_rpc_server* rpcs, rpc_ptr buf)

Free the specified buffer in TA address space.

Parameters:

rpcs

RPC server handle

buf

identifier of the buffer to be freed

uint64_t rpc_get_addr_by_id(rcf_rpc_server* rpcs, rpc_ptr id)

Get address in the TA address space by its ID.

Parameters:

rpcs

RPC server handle

id

Address ID

Returns:

Value of address in the TA address space

static bool rpc_malloc_off(rcf_rpc_server* rpcs, size_t size, rpc_ptr_off** buf)

Allocate a buffer of specified size in the TA address space.

Parameters:

rpcs

RPC server handle

size

size of the buffer to be allocated

Returns:

Allocated buffer identifier with offset. It should be validated by RPC_PTR_OFF_IS_VALID()

static void rpc_free_off(rcf_rpc_server* rpcs, rpc_ptr_off* buf)

Free the specified buffer in TA address space.

Parameters:

rpcs

RPC server handle

buf

Identifier of the buffer to be freed with offset. Offset should be zero.

rpc_ptr rpc_malloc_misaligned(rcf_rpc_server* rpcs, size_t alignment, size_t size, size_t offset)

Allocate a buffer of specified size in the TA address space that should be misaligned. That means that an aligned memory is allocated, however it should be considered as an allocated memory that starts with some offset that is less than size.

Parameters:

rpcs

RPC server handle

alignment

buffer alignment

size

size of the buffer to be allocated

offset

offset

Returns:

Allocated buffer identifier or RPC_NULL

int rpc_posix_memalign(rcf_rpc_server* rpcs, rpc_ptr* ptr, size_t alignment, size_t size)

Allocate a buffer of specified size in the TA address space aligned at a specified boundary.

Parameters:

rpcs

RPC server handle

ptr

allocated buffer identifier

alignment

alignment of the buffer

size

size of the buffer to be allocated

Returns:

0 on success or code of the error on failure

int rpc_setrlimit(rcf_rpc_server* rpcs, int resource, const tarpc_rlimit* rlim)

Set resource limits and usage

Parameters:

rpcs

RPC server

resource

Resource type (see ‘man 2 setrlimit’).

rlim

RPC analog of rlimit structure (see ‘man 2 setrlimit’).

Returns:

-1 in the case of failure or 0 on success

int rpc_getrlimit(rcf_rpc_server* rpcs, int resource, tarpc_rlimit* rlim)

Get resource limits and usage

Parameters:

rpcs

RPC server

resource

Resource type (see ‘man 2 getrlimit’).

rlim

RPC analog of rlimit structure (see ‘man 2 getrlimit’).

Returns:

-1 in the case of failure or 0 on success

int64_t rpc_sysconf(rcf_rpc_server* rpcs, rpc_sysconf_name name)

RPC sysconf() call.

Parameters:

rpcs

RPC server

name

Name of sysconf() constant

Returns:

-1 in the case of failure or a value of system resource

int rpc_fstat(rcf_rpc_server* rpcs, int fd, rpc_stat* buf)

Get file status.

Parameters:

rpcs

RPC server

fd

FD to stat

buf

Buffer for file status.

Returns:

-1 in the case of failure or 0 on success

int rpc_stat_func(rcf_rpc_server* rpcs, const char* path, rpc_stat* buf)

Get file status.

Parameters:

rpcs

RPC server

path

path to a file

buf

Buffer for file status.

Returns:

-1 in the case of failure or 0 on success

int rpc_link(rcf_rpc_server* rpcs, const char* path1, const char* path2)

Create a new link for existing file.

Parameters:

rpcs

RPC server

path1

Pathname naming an existing file

path2

Pathname naming the new directory entry to be created

Returns:

-1 in the case of failure or 0 on success

int rpc_symlink(rcf_rpc_server* rpcs, const char* path1, const char* path2)

Create a symbolic link to a file.

Parameters:

rpcs

RPC server

path1

String contained in the symbolic link

path2

Name of the symbolic link created

Returns:

-1 in the case of failure or 0 on success

ssize_t rpc_readlink(rcf_rpc_server* rpcs, const char* path, char* buf, size_t bufsize)

Resolve a symbolic link.

Parameters:

rpcs

RPC server handle.

path

Path to symbolic link.

buf

Buffer for the resolved link.

bufsize

Length of the buffer.

Returns:

Number of bytes put in the buffer.

int rpc_unlink(rcf_rpc_server* rpcs, const char* path)

Remove a directory entry.

Parameters:

rpcs

RPC server

path

Path of the file to be removed

Returns:

-1 in the case of failure or 0 on success

int rpc_mkdir(rcf_rpc_server* rpcs, const char* path, rpc_file_mode_flags mode)

Create a directory.

Parameters:

rpcs

RPC server

path

Path of the directory to be created

mode

The permission bits to assign to a new directory

Returns:

-1 in the case of failure or 0 on success

int rpc_mkdirp(rcf_rpc_server* rpcs, const char* path, rpc_file_mode_flags mode)

Create the directory(ies), if they do not already exist

Parameters:

rpcs

RPC server

path

Path of the directory to be created

mode

The permission bits to assign to a new directory

Returns:

-1 on failure, 0 if the directory has been created or existing

int rpc_rmdir(rcf_rpc_server* rpcs, const char* path)

Remove a directory.

Parameters:

rpcs

RPC server

path

Path of the directory to be removed

Returns:

-1 in the case of failure or 0 on success

int rpc_rename(rcf_rpc_server* rpcs, const char* path_old, const char* path_new)

Rename a directory entry.

Parameters:

rpcs

RPC server

path_old

Current directory entry path

path_new

New directory entry path

Returns:

-1 in the case of failure or 0 on success

int rpc_fstatvfs(rcf_rpc_server* rpcs, int fd, tarpc_statvfs* buf)

Get file system information.

Parameters:

rpcs

RPC server

fd

file descriptor opened on file system whose information we want to obtain

buf

structure with file system information (OUT)

Returns:

-1 in the case of failure or 0 on success

int rpc_statvfs(rcf_rpc_server* rpcs, const char* path, tarpc_statvfs* buf)

Get file system information by path.

Parameters:

rpcs

RPC server

path

path to a directory entry on a volume whose information we want to obtain

buf

structure with file system information (OUT)

Returns:

-1 in the case of failure or 0 on success

int rpc_gethostname(rcf_rpc_server* rpcs, char* name, size_t len)

Get hostname

Parameters:

rpcs

RPC server

name

Hostname

len

Length of buffer in name argument

Returns:

-1 in the case of failure or 0 on success

int rpc_chroot(rcf_rpc_server* rpcs, char* path)

Change root directory.

Parameters:

rpcs

RPC server

path

Path to a new root directory

Returns:

-1 in the case of failure or 0 on success

int rpc_copy_ta_libs(rcf_rpc_server* rpcs, char* path)

Copy dynamic libraries necessary to run TA to its directory (can be used to perform exec() after chroot()).

Parameters:

rpcs

RPC server

path

Path to a new root directory

Returns:

-1 in the case of failure or 0 on success

int rpc_rm_ta_libs(rcf_rpc_server* rpcs, char* path)

Removie lib/ folder from TA folder (used for cleanup after rpc_copy_ta_libs()).

Parameters:

rpcs

RPC server

path

Path to a new root directory

Returns:

-1 in the case of failure or 0 on success

int rpc_execve_gen(rcf_rpc_server* rpcs, const char* filename, char*const argv[], char*const envp[])

Execute program filename

Parameters:

rpcs

RPC server

filename

Pathname to the program or script

argv

Array of argument strings

envp

Array of strings which are passed as environment

void rpc_make_iov(rpc_iovec* iov, size_t iovcnt, size_t min, size_t max)

Allocate buffers for iov vectors and set length fields.

Parameters:

iov

Iov vectors array.

iovcnt

Vectors number.

min

Minimum buffer length.

max

Maximum buffer length.

void rpc_release_iov(rpc_iovec* iov, size_t iovcnt)

Free buffers of iov vector.

Parameters:

iov

Iov vectors array.

iovcnt

Vectors number.

void rpc_alloc_iov(rpc_iovec** iov, size_t iovcnt, size_t min, size_t max)

Allocate array of IOV vectors and its elements, set buffer lengths.

Parameters:

iov

Iov vectors array.

iovcnt

Vectors number.

min

Minimum buffer length.

max

Maximum buffer length.

void rpc_free_iov(rpc_iovec* iov, size_t iovcnt)

Free buffers of IOV array and the array itself.

Parameters:

iov

Iov vectors array.

iovcnt

Vectors number.

uint8_t* rpc_iov_append2dbuf(const rpc_iovec* iov, size_t iovcnt, te_dbuf* buf)

Append data from IOV array to te_dbuf.

Parameters:

iov

IOV array.

iovcnt

Number of vectors in array.

buf

Dynamic buffer to append data to.

Returns:

Pointer to buffer with copied data.

uint8_t* rpc_iov2dbuf(const rpc_iovec* iov, size_t iovcnt, te_dbuf* buf)

Copy data from IOV array to te_dbuf.

Parameters:

iov

IOV array.

iovcnt

Number of vectors in array.

buf

Dynamic buffer to copy data to.

Returns:

Pointer to buffer with copied data.

size_t rpc_iov_data_len(const rpc_iovec* iov, size_t iovcnt)

Get length of data stored in IOV array.

Parameters:

iov

IOV array.

iovcnt

Number of vectors in array.

Returns:

Total length of data stored in vectors.

Macros

#define CLEANUP_RPC_FREE(_rpcs, _ptr)

Free memory allocated on RPC server in cleanup part of the test.

Parameters:

_rpcs

RPC server handle

_ptr

memory identifier