Added implementations of alarm() and ualarm() based on setitimer() (which doesn't
work yet correctly). Added empty sbrk() for now - not sure what to do with this. Maybe we should remove it completely (but BeOS bash needs it). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8767 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,33 +1,36 @@
|
|||||||
SubDir OBOS_TOP src kernel libroot posix unistd ;
|
SubDir OBOS_TOP src kernel libroot posix unistd ;
|
||||||
|
|
||||||
KernelMergeObject posix_unistd.o :
|
KernelMergeObject posix_unistd.o :
|
||||||
<$(SOURCE_GRIST)>access.c
|
access.c
|
||||||
<$(SOURCE_GRIST)>chown.c
|
alarm.c
|
||||||
<$(SOURCE_GRIST)>close.c
|
chown.c
|
||||||
<$(SOURCE_GRIST)>conf.c
|
close.c
|
||||||
<$(SOURCE_GRIST)>directory.c
|
conf.c
|
||||||
<$(SOURCE_GRIST)>dup.c
|
directory.c
|
||||||
<$(SOURCE_GRIST)>exec.c
|
dup.c
|
||||||
<$(SOURCE_GRIST)>_exit.c
|
exec.c
|
||||||
<$(SOURCE_GRIST)>fcntl.c
|
_exit.c
|
||||||
<$(SOURCE_GRIST)>fork.c
|
fcntl.c
|
||||||
<$(SOURCE_GRIST)>getopt.c
|
fork.c
|
||||||
<$(SOURCE_GRIST)>hostname.c
|
getopt.c
|
||||||
<$(SOURCE_GRIST)>ioctl.c
|
hostname.c
|
||||||
<$(SOURCE_GRIST)>link.c
|
ioctl.c
|
||||||
<$(SOURCE_GRIST)>lseek.c
|
link.c
|
||||||
<$(SOURCE_GRIST)>mount.c
|
lseek.c
|
||||||
<$(SOURCE_GRIST)>open.c
|
mount.c
|
||||||
<$(SOURCE_GRIST)>pipe.c
|
open.c
|
||||||
<$(SOURCE_GRIST)>process.c
|
pipe.c
|
||||||
<$(SOURCE_GRIST)>read.c
|
process.c
|
||||||
<$(SOURCE_GRIST)>sleep.c
|
read.c
|
||||||
<$(SOURCE_GRIST)>sync.c
|
sbrk.c
|
||||||
<$(SOURCE_GRIST)>terminal.c
|
sleep.c
|
||||||
<$(SOURCE_GRIST)>truncate.c
|
sync.c
|
||||||
<$(SOURCE_GRIST)>ttyname.c
|
terminal.c
|
||||||
<$(SOURCE_GRIST)>usergroup.c
|
truncate.c
|
||||||
<$(SOURCE_GRIST)>usleep.c
|
ttyname.c
|
||||||
<$(SOURCE_GRIST)>write.c
|
ualarm.c
|
||||||
|
usergroup.c
|
||||||
|
usleep.c
|
||||||
|
write.c
|
||||||
: -fPIC -DPIC
|
: -fPIC -DPIC
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
|
** Distributed under the terms of the Haiku License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <syscalls.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
|
** Distributed under the terms of the Haiku License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
|
void *
|
||||||
|
sbrk(long increment)
|
||||||
|
{
|
||||||
|
// this function is no longer supported
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
|
** Distributed under the terms of the Haiku License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <syscalls.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user