libports: add fcntl() to libc_lwip

Fixes #326.
This commit is contained in:
Josef Söntgen 2012-08-13 15:32:21 +02:00 committed by Norman Feske
parent 74b7b768f8
commit bee2c10ce1

View File

@ -180,6 +180,7 @@ struct Plugin : Libc::Plugin
int connect(Libc::File_descriptor *sockfdo,
const struct sockaddr *addr,
socklen_t addrlen);
int fcntl(Libc::File_descriptor *sockfdo, int cmd, long val);
void freeaddrinfo(struct ::addrinfo *res);
int getaddrinfo(const char *node, const char *service,
const struct ::addrinfo *hints,
@ -312,6 +313,25 @@ int Plugin::connect(Libc::File_descriptor *sockfdo,
}
int Plugin::fcntl(Libc::File_descriptor *sockfdo, int cmd, long val)
{
int s = get_lwip_fd(sockfdo);
int result = -1;
switch (cmd) {
case F_GETFL:
case F_SETFL:
result = lwip_fcntl(s, cmd, val);
break;
default:
PERR("unsupported fcntl() request");
break;
}
return result;
}
void Plugin::freeaddrinfo(struct ::addrinfo *res)
{
struct ::addrinfo *next;