jehanne: move _fcntl_r to libposix_conf.c (to easily access fcntl.h)
This commit is contained in:
@ -355,3 +355,35 @@ initialize_newlib(void)
|
|||||||
if(__application_newlib_init != 0)
|
if(__application_newlib_init != 0)
|
||||||
__application_newlib_init();
|
__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);
|
||||||
|
}
|
||||||
|
@ -213,13 +213,6 @@ _gettimeofday_r(struct _reent *r, struct timeval *p, void *z)
|
|||||||
return POSIX_gettimeofday(errnop, p, 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
|
unsigned int
|
||||||
sleep(unsigned int seconds)
|
sleep(unsigned int seconds)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user