libc: Add lseek()
This commit is contained in:
parent
928ade123c
commit
4a5db1dca7
8
libs/libc/include/bits/seek.h
Normal file
8
libs/libc/include/bits/seek.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef _BITS_SEEK_H
|
||||
#define _BITS_SEEK_H
|
||||
|
||||
#define SEEK_SET 0 // Seek from beginning of file.
|
||||
#define SEEK_CUR 1 // Seek from current position.
|
||||
#define SEEK_END 2 // Seek from end of file.
|
||||
|
||||
#endif
|
@ -4,7 +4,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define SEEK_SET 0
|
||||
#include <bits/seek.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef _UNISTD_H
|
||||
#define _UNISTD_H
|
||||
|
||||
#include <bits/seek.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -32,6 +33,9 @@ extern "C"
|
||||
/* Closes the file descriptor fd. */
|
||||
int close(int fd);
|
||||
|
||||
/* Moves the read/write file offset for fd to offset, depending on whence. */
|
||||
off_t lseek(int fd, off_t offset, int whence);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -89,4 +89,9 @@ extern "C"
|
||||
{
|
||||
return (int)syscall(SYS_close, fd);
|
||||
}
|
||||
|
||||
off_t lseek(int fd, off_t offset, int whence)
|
||||
{
|
||||
return syscall(SYS_seek, fd, offset, whence);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user