source: trunk/libs/newlib/src/newlib/libc/sys/linux/io64.c

Last change on this file was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.8 KB
Line 
1/* libc/sys/linux/io64.c - large file input/output system calls */
2
3/* Copyright 2002, Red Hat Inc. */
4
5
6#define __KERNEL_PROTOTYPES
7
8#include <stdarg.h>
9#include <unistd.h>
10#include <fcntl.h>
11#include <sys/types.h>
12#include <sys/uio.h>
13#include <sys/stat.h>
14#include <sys/ioctl.h>
15#include <machine/syscall.h>
16
17#define __NR___truncate64 __NR_truncate64
18#define __NR___ftruncate64 __NR_ftruncate64
19
20_syscall2(int,fstat64,int,fd,struct stat64 *,st)
21_syscall2(int,lstat64,const char *,name,struct stat64 *,st)
22_syscall2(int,stat64,const char *,name,struct stat64 *,st)
23
24static _syscall3(int,__truncate64,const char *,name,int,high,int,low)
25
26int __libc_truncate64(const char *name, off64_t length)
27{
28  return __truncate64(name,(length >> 32), (length & 0xffffffff));
29}
30weak_alias(__libc_truncate64,truncate64)
31
32static _syscall3(int,__ftruncate64,int,fd,int,high,int,low);
33
34int __libc_ftruncate64(int fd, off64_t length)
35{
36  return __ftruncate64(fd,(length >> 32),(length & 0xffffffff));
37}
38weak_alias(__libc_ftruncate64,ftruncate64)
39
40static _syscall5(void,_llseek,int,fd,off_t,hi,off_t,lo,loff_t *,pos,int,whence)
41
42loff_t __libc_lseek64(int fd, loff_t offset, int whence)
43{
44  loff_t pos;
45  __libc__llseek(fd, offset >> 32, offset & 0xffffffff, &pos, whence);
46  return pos;
47}
48weak_alias(__libc_lseek64,lseek64);
49weak_alias(__libc_lseek64,_lseek64);
50
51int __libc_open64(const char *path, int oflag, ...)
52{
53   mode_t mode = 0;
54   if (oflag & O_CREAT)
55     {
56       va_list list;
57       va_start(list, oflag);
58       mode = va_arg(list, int);
59       va_end(list);
60     }
61   return __libc_open(path, oflag | O_LARGEFILE, mode);
62}
63weak_alias(__libc_open64,open64);
64weak_alias(__libc_open64,_open64);
65weak_alias(__libc_open64,__open64);
66weak_alias(__libc_fstat64,_fstat64);
67weak_alias(__libc_stat64,_stat64);
68
69
Note: See TracBrowser for help on using the repository browser.