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:
parent
61d7deee8a
commit
5be3370fe7
@ -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
|
||||
;
|
||||
|
28
src/kernel/libroot/posix/unistd/alarm.c
Normal file
28
src/kernel/libroot/posix/unistd/alarm.c
Normal file
@ -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 <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;
|
||||
}
|
||||
|
16
src/kernel/libroot/posix/unistd/sbrk.c
Normal file
16
src/kernel/libroot/posix/unistd/sbrk.c
Normal file
@ -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 <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
void *
|
||||
sbrk(long increment)
|
||||
{
|
||||
// this function is no longer supported
|
||||
return NULL;
|
||||
}
|
26
src/kernel/libroot/posix/unistd/ualarm.c
Normal file
26
src/kernel/libroot/posix/unistd/ualarm.c
Normal file
@ -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 <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;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user