jehanne: move _fcntl_r to libposix_conf.c (to easily access fcntl.h)

This commit is contained in:
Giacomo Tesio 2017-09-27 23:34:42 +02:00
parent 8a57809fe4
commit 5c85f0f91d
2 changed files with 32 additions and 7 deletions

View File

@ -355,3 +355,35 @@ initialize_newlib(void)
if(__application_newlib_init != 0)
__application_newlib_init();
}
/* _fcntl_r is here to access <fcntl.h> */
int
_fcntl_r(struct _reent *r, int fd, int cmd, int arg)
{
int *errnop = &r->_errno;
PosixFDCmds pcmd;
switch(cmd){
case F_DUPFD:
pcmd = PosixFDCDupFD;
break;
case F_DUPFD_CLOEXEC:
pcmd = PosixFDCDupFDCloseOnExec;
break;
case F_GETFD:
pcmd = PosixFDCGetFD;
break;
case F_SETFD:
pcmd = PosixFDCSetFD;
break;
case F_GETFL:
pcmd = PosixFDCGetFL;
break;
case F_SETFL:
pcmd = PosixFDCSetFL;
break;
default:
*errnop = EINVAL;
return -1;
}
return POSIX_fcntl(errnop, fd, pcmd, arg);
}

View File

@ -213,13 +213,6 @@ _gettimeofday_r(struct _reent *r, struct timeval *p, void *z)
return POSIX_gettimeofday(errnop, p, z);
}
int
_fcntl_r(struct _reent *r, int fd, int cmd, int arg)
{
int *errnop = &r->_errno;
return POSIX_fcntl(errnop, fd, cmd, arg);
}
unsigned int
sleep(unsigned int seconds)
{