From c89cbee2cf623ddd06c76262ca39280d712135c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 3 Nov 2004 15:05:35 +0000 Subject: [PATCH] Added missing times() function (almost empty stub implementation). Implemented uio.h functions: readv/writev[_pos](). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9770 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/posix/sys/Jamfile | 2 + src/kernel/libroot/posix/sys/times.c | 24 ++++++++++++ src/kernel/libroot/posix/sys/uio.c | 55 ++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 src/kernel/libroot/posix/sys/times.c create mode 100644 src/kernel/libroot/posix/sys/uio.c diff --git a/src/kernel/libroot/posix/sys/Jamfile b/src/kernel/libroot/posix/sys/Jamfile index d9f6cd7492..5c3ec8cb11 100644 --- a/src/kernel/libroot/posix/sys/Jamfile +++ b/src/kernel/libroot/posix/sys/Jamfile @@ -11,6 +11,8 @@ KernelMergeObject posix_sys.o : select.c stat.c sysctl.c + times.c + uio.c umask.c wait.c : -fPIC -DPIC diff --git a/src/kernel/libroot/posix/sys/times.c b/src/kernel/libroot/posix/sys/times.c new file mode 100644 index 0000000000..e43d0ac758 --- /dev/null +++ b/src/kernel/libroot/posix/sys/times.c @@ -0,0 +1,24 @@ +/* +** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the Haiku License. +*/ + + +#include + +#include +#include + + +clock_t +times(struct tms *buffer) +{ + // ToDo: get some real values here! + buffer->tms_utime = 0; + buffer->tms_stime = 0; + buffer->tms_cutime = 0; + buffer->tms_cstime = 0; + + return real_time_clock() * CLK_TCK; +} + diff --git a/src/kernel/libroot/posix/sys/uio.c b/src/kernel/libroot/posix/sys/uio.c new file mode 100644 index 0000000000..77eb2e1d7f --- /dev/null +++ b/src/kernel/libroot/posix/sys/uio.c @@ -0,0 +1,55 @@ +/* +** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the Haiku License. +*/ + + +#include + +#include +#include + + +#define RETURN_AND_SET_ERRNO(err) \ + if (err < 0) { \ + errno = err; \ + return -1; \ + } \ + return err; + + +ssize_t +readv(int fd, const struct iovec *vecs, size_t count) +{ + ssize_t bytes = _kern_readv(fd, -1, vecs, count); + + RETURN_AND_SET_ERRNO(bytes); +} + + +ssize_t +readv_pos(int fd, off_t pos, const struct iovec *vecs, size_t count) +{ + ssize_t bytes = _kern_readv(fd, pos, vecs, count); + + RETURN_AND_SET_ERRNO(bytes); +} + + +ssize_t +writev(int fd, const struct iovec *vecs, size_t count) +{ + ssize_t bytes = _kern_writev(fd, -1, vecs, count); + + RETURN_AND_SET_ERRNO(bytes); +} + + +ssize_t +writev_pos(int fd, off_t pos, const struct iovec *vecs, size_t count) +{ + ssize_t bytes = _kern_writev(fd, pos, vecs, count); + + RETURN_AND_SET_ERRNO(bytes); +} +