jehanne: completed termios and drafted (f)pathconf

I/O baudrate hard coded at 38400 (set functions fail with EINVAL).

fpathconf and pathconf fail with EINVAL
This commit is contained in:
Giacomo Tesio 2018-11-20 11:57:25 +01:00
parent 1a528f159d
commit 699179a669
3 changed files with 50 additions and 1 deletions

View File

@ -425,3 +425,11 @@ jehanne_fprint(2, "_fcntl_r(%d, %d, %d) from %#p\n", fd, cmd, arg, jehanne_getca
}
return POSIX_fcntl(errnop, fd, pcmd, arg);
}
int
__fail_with_einval(void)
{
int *errnop = &_REENT->_errno;
*errnop = EINVAL;
return -1;
}

View File

@ -20,9 +20,24 @@
#include <posix.h>
#include <reent.h>
extern _fcntl_r(struct _reent *r, int fd, int cmd, int arg);
extern int __fail_with_einval(void);
int
fcntl(int fd, int cmd, int arg)
{
return _fcntl_r (_REENT, fd, cmd, arg);
}
long
fpathconf(int fildes, int name)
{
extern int _fcntl_r(struct _reent *r, int fd, int cmd, int arg);
return __fail_with_einval();
}
long
pathconf(const char *path, int name)
{
extern int _fcntl_r(struct _reent *r, int fd, int cmd, int arg);
return __fail_with_einval();
}

View File

@ -84,3 +84,29 @@ tcsetattr(int fd, int optactions, const struct termios *t)
return 0;
return -1;
}
speed_t
cfgetispeed(const struct termios *t)
{
return 38400;
}
speed_t
cfgetospeed(const struct termios *t)
{
return 38400;
}
int
cfsetispeed(struct termios *tp, speed_t speed)
{
extern int _fcntl_r(struct _reent *r, int fd, int cmd, int arg);
return __fail_with_einval();
}
int
cfsetospeed(struct termios *tp, speed_t speed)
{
extern int _fcntl_r(struct _reent *r, int fd, int cmd, int arg);
return __fail_with_einval();
}