evl/proxy: introduce file proxy interface
This commit is contained in:
parent
70912c1712
commit
4314ff1bb1
|
@ -17,6 +17,7 @@
|
|||
#include <evenless/thread.h>
|
||||
#include <evenless/xbuf.h>
|
||||
#include <evenless/poll.h>
|
||||
#include <evenless/proxy.h>
|
||||
|
||||
#define __EVL__ 0 /* API revision */
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Copyright (C) 2019 Philippe Gerum <rpm@xenomai.org>
|
||||
*/
|
||||
|
||||
#ifndef _EVENLESS_PROXY_H
|
||||
#define _EVENLESS_PROXY_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <linux/types.h>
|
||||
#include <uapi/evenless/proxy.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int evl_new_proxy(int fd, size_t bufsz,
|
||||
const char *fmt, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _EVENLESS_PROXY_H */
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Copyright (C) 2019 Philippe Gerum <rpm@xenomai.org>
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <evenless/proxy.h>
|
||||
#include <evenless/syscall.h>
|
||||
#include "internal.h"
|
||||
|
||||
int evl_new_proxy(int fd, size_t bufsz, const char *fmt, ...)
|
||||
{
|
||||
struct evl_proxy_attrs attrs;
|
||||
int ret, efd;
|
||||
va_list ap;
|
||||
char *name;
|
||||
|
||||
va_start(ap, fmt);
|
||||
ret = vasprintf(&name, fmt, ap);
|
||||
va_end(ap);
|
||||
if (ret < 0)
|
||||
return -ENOMEM;
|
||||
|
||||
attrs.fd = fd;
|
||||
attrs.bufsz = bufsz;
|
||||
efd = create_evl_element("proxy", name, &attrs, NULL);
|
||||
free(name);
|
||||
|
||||
return efd;
|
||||
}
|
Loading…
Reference in New Issue