Welcome to mirror list, hosted at ThFree Co, Russian Federation.

io.c « linux « sys « libc « newlib - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6187e701bfa0ce242069b6c12a7a7ed7f3c63dea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* libc/sys/linux/io.c - Basic input/output system calls */

/* Written 2000 by Werner Almesberger */


#define __KERNEL_PROTOTYPES

#include <stdarg.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/syscall.h>


#define __NR___ioctl __NR_ioctl
#define __NR___flock __NR_flock

_syscall3(int,read,int,fd,void *,buf,size_t,count)
_syscall3(int,write,int,fd,const void *,buf,size_t,count)
_syscall3(int,open,const char *,file,int,flag,mode_t,mode)
_syscall1(int,close,int,fd)
_syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
_syscall0(int,sync)
_syscall1(int,dup,int,fd)
_syscall2(int,dup2,int,oldfd,int,newfd)
_syscall3(int,fcntl,int,fd,int,cmd,long,arg)


static _syscall3(int,__ioctl,int,fd,int,request,void *,arg)


int ioctl(int fd,int request,...)
{
    va_list ap;
    int res;

    va_start(ap,request);
    res = __ioctl(fd,request,va_arg(ap,void *));
    va_end(ap);
    return res;
}


/* Why are all the types gratuituously different ? */

static _syscall2(long,__flock,unsigned int,fd,unsigned int,cmd)


int flock(int fd,int operation)
{
    return __flock(fd,operation);
}