Added truncate() and ftruncate() library calls (no FS support yet).
Added ELOOP message to errlist.
This commit is contained in:
parent
fbc190e562
commit
ffe192724e
5 changed files with 43 additions and 6 deletions
|
@ -49,7 +49,7 @@ const char *_sys_errlist[] = {
|
|||
"No locks available", /* ENOLCK */
|
||||
"Function not implemented", /* ENOSYS */
|
||||
"Directory not empty", /* ENOTEMPTY */
|
||||
unknown, /* 40 */
|
||||
"Too many levels of symbolic links", /* ELOOP */
|
||||
unknown, /* 41 */
|
||||
unknown, /* 42 */
|
||||
unknown, /* 43 */
|
||||
|
|
|
@ -47,6 +47,7 @@ libc_OBJECTS = \
|
|||
_kill.o \
|
||||
_link.o \
|
||||
_lseek.o \
|
||||
_lstat.o \
|
||||
_mkdir.o \
|
||||
_mkfifo.o \
|
||||
_mknod.o \
|
||||
|
@ -62,6 +63,7 @@ libc_OBJECTS = \
|
|||
_rename.o \
|
||||
_rewinddir.o \
|
||||
_rmdir.o \
|
||||
_readlink.o \
|
||||
_select.o \
|
||||
_setgid.o \
|
||||
_setsid.o \
|
||||
|
@ -76,6 +78,7 @@ libc_OBJECTS = \
|
|||
_sleep.o \
|
||||
_stat.o \
|
||||
_stime.o \
|
||||
_symlink.o \
|
||||
_sync.o \
|
||||
_tcdrain.o \
|
||||
_tcflow.o \
|
||||
|
@ -85,6 +88,7 @@ libc_OBJECTS = \
|
|||
_tcsetattr.o \
|
||||
_time.o \
|
||||
_times.o \
|
||||
_truncate.o \
|
||||
_umask.o \
|
||||
_umount.o \
|
||||
_uname.o \
|
||||
|
@ -93,14 +97,11 @@ libc_OBJECTS = \
|
|||
_wait.o \
|
||||
_waitpid.o \
|
||||
_write.o \
|
||||
gettimeofday.o \
|
||||
getloadavg.o \
|
||||
getopt.o \
|
||||
_lstat.o \
|
||||
gettimeofday.o \
|
||||
priority.o \
|
||||
_readlink.o \
|
||||
_symlink.o \
|
||||
usleep.o \
|
||||
getloadavg.o
|
||||
|
||||
include ../Makefile.inc
|
||||
|
||||
|
|
22
lib/posix/_truncate.c
Executable file
22
lib/posix/_truncate.c
Executable file
|
@ -0,0 +1,22 @@
|
|||
#include <lib.h>
|
||||
#define truncate _truncate
|
||||
#define ftruncate _ftruncate
|
||||
#include <unistd.h>
|
||||
|
||||
PUBLIC int truncate(const char *_path, off_t _length)
|
||||
{
|
||||
message m;
|
||||
m.m1_p1 = (char *) _path;
|
||||
m.m1_i1 = _length;
|
||||
|
||||
return(_syscall(FS, TRUNCATE, &m));
|
||||
}
|
||||
|
||||
PUBLIC int ftruncate(int _fd, off_t _length)
|
||||
{
|
||||
message m;
|
||||
m.m1_i2 = _fd;
|
||||
m.m1_i1 = _length;
|
||||
|
||||
return(_syscall(FS, FTRUNCATE, &m));
|
||||
}
|
|
@ -101,6 +101,7 @@ libc_OBJECTS = \
|
|||
tcsetattr.o \
|
||||
time.o \
|
||||
times.o \
|
||||
truncate.o \
|
||||
umask.o \
|
||||
umount.o \
|
||||
uname.o \
|
||||
|
|
13
lib/syscall/truncate.s
Executable file
13
lib/syscall/truncate.s
Executable file
|
@ -0,0 +1,13 @@
|
|||
.sect .text
|
||||
.extern __truncate
|
||||
.extern __ftruncate
|
||||
.define _truncate
|
||||
.define _ftruncate
|
||||
.align 2
|
||||
|
||||
_truncate:
|
||||
jmp __truncate
|
||||
|
||||
.align 2
|
||||
_ftruncate:
|
||||
jmp __ftruncate
|
Loading…
Reference in a new issue