diff --git a/src/kernel/libroot/posix/unistd/Jamfile b/src/kernel/libroot/posix/unistd/Jamfile index 9929dec2c2..29d213effb 100644 --- a/src/kernel/libroot/posix/unistd/Jamfile +++ b/src/kernel/libroot/posix/unistd/Jamfile @@ -1,33 +1,36 @@ SubDir OBOS_TOP src kernel libroot posix unistd ; KernelMergeObject posix_unistd.o : - <$(SOURCE_GRIST)>access.c - <$(SOURCE_GRIST)>chown.c - <$(SOURCE_GRIST)>close.c - <$(SOURCE_GRIST)>conf.c - <$(SOURCE_GRIST)>directory.c - <$(SOURCE_GRIST)>dup.c - <$(SOURCE_GRIST)>exec.c - <$(SOURCE_GRIST)>_exit.c - <$(SOURCE_GRIST)>fcntl.c - <$(SOURCE_GRIST)>fork.c - <$(SOURCE_GRIST)>getopt.c - <$(SOURCE_GRIST)>hostname.c - <$(SOURCE_GRIST)>ioctl.c - <$(SOURCE_GRIST)>link.c - <$(SOURCE_GRIST)>lseek.c - <$(SOURCE_GRIST)>mount.c - <$(SOURCE_GRIST)>open.c - <$(SOURCE_GRIST)>pipe.c - <$(SOURCE_GRIST)>process.c - <$(SOURCE_GRIST)>read.c - <$(SOURCE_GRIST)>sleep.c - <$(SOURCE_GRIST)>sync.c - <$(SOURCE_GRIST)>terminal.c - <$(SOURCE_GRIST)>truncate.c - <$(SOURCE_GRIST)>ttyname.c - <$(SOURCE_GRIST)>usergroup.c - <$(SOURCE_GRIST)>usleep.c - <$(SOURCE_GRIST)>write.c + access.c + alarm.c + chown.c + close.c + conf.c + directory.c + dup.c + exec.c + _exit.c + fcntl.c + fork.c + getopt.c + hostname.c + ioctl.c + link.c + lseek.c + mount.c + open.c + pipe.c + process.c + read.c + sbrk.c + sleep.c + sync.c + terminal.c + truncate.c + ttyname.c + ualarm.c + usergroup.c + usleep.c + write.c : -fPIC -DPIC ; diff --git a/src/kernel/libroot/posix/unistd/alarm.c b/src/kernel/libroot/posix/unistd/alarm.c new file mode 100644 index 0000000000..ad54f459c2 --- /dev/null +++ b/src/kernel/libroot/posix/unistd/alarm.c @@ -0,0 +1,28 @@ +/* +** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the Haiku License. +*/ + + +#include +#include +#include + + +uint +alarm(unsigned int sec) +{ + struct itimerval value, oldValue; + + value.it_interval.tv_sec = value.it_interval.tv_usec = 0; + value.it_value.tv_sec = sec; + value.it_value.tv_usec = 0; + if (setitimer(ITIMER_REAL, &value, &oldValue) < 0) + return -1; + + if (oldValue.it_value.tv_usec) + oldValue.it_value.tv_sec++; + + return oldValue.it_value.tv_sec; +} + diff --git a/src/kernel/libroot/posix/unistd/sbrk.c b/src/kernel/libroot/posix/unistd/sbrk.c new file mode 100644 index 0000000000..c535268c6f --- /dev/null +++ b/src/kernel/libroot/posix/unistd/sbrk.c @@ -0,0 +1,16 @@ +/* +** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the Haiku License. +*/ + + +#include +#include + + +void * +sbrk(long increment) +{ + // this function is no longer supported + return NULL; +} diff --git a/src/kernel/libroot/posix/unistd/ualarm.c b/src/kernel/libroot/posix/unistd/ualarm.c new file mode 100644 index 0000000000..c82f8c7898 --- /dev/null +++ b/src/kernel/libroot/posix/unistd/ualarm.c @@ -0,0 +1,26 @@ +/* +** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the Haiku License. +*/ + + +#include +#include +#include + + +uint +ualarm(uint usec, uint interval) +{ + struct itimerval value, oldValue; + + value.it_value.tv_sec = 0; + value.it_value.tv_usec = usec; + value.it_interval.tv_sec = 0; + value.it_interval.tv_usec = interval; + + if (setitimer(ITIMER_REAL, &value, &oldValue) < 0) + return -1; + + return (oldValue.it_value.tv_sec * 1000000) + oldValue.it_value.tv_usec; +}