ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libeio/eio.c
(Generate patch)

Comparing libeio/eio.c (file contents):
Revision 1.139 by root, Thu Jun 25 18:14:19 2015 UTC vs.
Revision 1.142 by root, Sun May 1 17:15:45 2016 UTC

1/* 1/*
2 * libeio implementation 2 * libeio implementation
3 * 3 *
4 * Copyright (c) 2007,2008,2009,2010,2011,2012,2013 Marc Alexander Lehmann <libeio@schmorp.de> 4 * Copyright (c) 2007,2008,2009,2010,2011,2012,2013,2016 Marc Alexander Lehmann <libeio@schmorp.de>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without modifica- 7 * Redistribution and use in source and binary forms, with or without modifica-
8 * tion, are permitted provided that the following conditions are met: 8 * tion, are permitted provided that the following conditions are met:
9 * 9 *
42#endif 42#endif
43 43
44#include "eio.h" 44#include "eio.h"
45#include "ecb.h" 45#include "ecb.h"
46 46
47#ifdef EIO_STACKSIZE
48# define X_STACKSIZE EIO_STACKSIZE
49#endif
50#include "xthread.h"
51
52#include <errno.h> 47#include <errno.h>
53#include <stddef.h> 48#include <stddef.h>
54#include <stdlib.h> 49#include <stdlib.h>
55#include <string.h> 50#include <string.h>
56#include <errno.h> 51#include <errno.h>
122 #define chmod(path,mode) _chmod (path, mode) 117 #define chmod(path,mode) _chmod (path, mode)
123 #define dup(fd) _dup (fd) 118 #define dup(fd) _dup (fd)
124 #define dup2(fd1,fd2) _dup2 (fd1, fd2) 119 #define dup2(fd1,fd2) _dup2 (fd1, fd2)
125 #define pipe(fds) _pipe (fds, 4096, O_BINARY) 120 #define pipe(fds) _pipe (fds, 4096, O_BINARY)
126 121
122 #define fcntl(fd,cmd,arg) EIO_ENOSYS ()
123 #define ioctl(fd,cmd,arg) EIO_ENOSYS ()
127 #define fchmod(fd,mode) EIO_ENOSYS () 124 #define fchmod(fd,mode) EIO_ENOSYS ()
128 #define chown(path,uid,gid) EIO_ENOSYS () 125 #define chown(path,uid,gid) EIO_ENOSYS ()
129 #define fchown(fd,uid,gid) EIO_ENOSYS () 126 #define fchown(fd,uid,gid) EIO_ENOSYS ()
130 #define truncate(path,offs) EIO_ENOSYS () /* far-miss: SetEndOfFile */ 127 #define truncate(path,offs) EIO_ENOSYS () /* far-miss: SetEndOfFile */
131 #define ftruncate(fd,offs) EIO_ENOSYS () /* near-miss: SetEndOfFile */ 128 #define ftruncate(fd,offs) EIO_ENOSYS () /* near-miss: SetEndOfFile */
281# include <utime.h> 278# include <utime.h>
282#endif 279#endif
283 280
284#if HAVE_SYS_SYSCALL_H 281#if HAVE_SYS_SYSCALL_H
285# include <sys/syscall.h> 282# include <sys/syscall.h>
286#endif
287
288#if HAVE_SYS_PRCTL_H
289# include <sys/prctl.h>
290#endif 283#endif
291 284
292#if HAVE_SENDFILE 285#if HAVE_SENDFILE
293# if __linux 286# if __linux
294# include <sys/sendfile.h> 287# include <sys/sendfile.h>
1816 : read (req->int1, req->ptr2, req->size); break; 1809 : read (req->int1, req->ptr2, req->size); break;
1817 case EIO_WRITE: req->result = req->offs >= 0 1810 case EIO_WRITE: req->result = req->offs >= 0
1818 ? pwrite (req->int1, req->ptr2, req->size, req->offs) 1811 ? pwrite (req->int1, req->ptr2, req->size, req->offs)
1819 : write (req->int1, req->ptr2, req->size); break; 1812 : write (req->int1, req->ptr2, req->size); break;
1820 1813
1814 case EIO_FCNTL: req->result = fcntl (req->int1, (int) req->int2, req->ptr2); break;
1815 case EIO_IOCTL: req->result = ioctl (req->int1, (unsigned long)req->int2, req->ptr2); break;
1816
1821 case EIO_READAHEAD: req->result = readahead (req->int1, req->offs, req->size); break; 1817 case EIO_READAHEAD: req->result = readahead (req->int1, req->offs, req->size); break;
1822 case EIO_SENDFILE: req->result = eio__sendfile (req->int1, req->int2, req->offs, req->size); break; 1818 case EIO_SENDFILE: req->result = eio__sendfile (req->int1, req->int2, req->offs, req->size); break;
1823 1819
1824#if HAVE_AT 1820#if HAVE_AT
1825 1821
2085eio_req *eio_write (int fd, void *buf, size_t length, off_t offset, int pri, eio_cb cb, void *data) 2081eio_req *eio_write (int fd, void *buf, size_t length, off_t offset, int pri, eio_cb cb, void *data)
2086{ 2082{
2087 REQ (EIO_WRITE); req->int1 = fd; req->offs = offset; req->size = length; req->ptr2 = buf; SEND; 2083 REQ (EIO_WRITE); req->int1 = fd; req->offs = offset; req->size = length; req->ptr2 = buf; SEND;
2088} 2084}
2089 2085
2086eio_req *eio_fcntl (int fd, int cmd, void *arg, int pri, eio_cb cb, void *data)
2087{
2088 REQ (EIO_IOCTL); req->int1 = fd; req->int2 = cmd; req->ptr2 = arg; SEND;
2089}
2090
2091eio_req *eio_ioctl (int fd, unsigned long request, void *buf, int pri, eio_cb cb, void *data)
2092{
2093 REQ (EIO_IOCTL); req->int1 = fd; req->int2 = request; req->ptr2 = buf; SEND;
2094}
2095
2090eio_req *eio_fstat (int fd, int pri, eio_cb cb, void *data) 2096eio_req *eio_fstat (int fd, int pri, eio_cb cb, void *data)
2091{ 2097{
2092 REQ (EIO_FSTAT); req->int1 = fd; SEND; 2098 REQ (EIO_FSTAT); req->int1 = fd; SEND;
2093} 2099}
2094 2100

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines