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

Comparing libeio/eio.c (file contents):
Revision 1.89 by root, Thu Jul 14 22:36:17 2011 UTC vs.
Revision 1.90 by root, Sat Jul 16 16:46:10 2011 UTC

67#endif 67#endif
68 68
69#ifndef ECANCELED 69#ifndef ECANCELED
70# define ECANCELED EDOM 70# define ECANCELED EDOM
71#endif 71#endif
72#ifndef ELOOP
73# define ELOOP EDOM
74#endif
72 75
73static void eio_destroy (eio_req *req); 76static void eio_destroy (eio_req *req);
74 77
75#ifndef EIO_FINISH 78#ifndef EIO_FINISH
76# define EIO_FINISH(req) ((req)->finish) && !EIO_CANCELLED (req) ? (req)->finish (req) : 0 79# define EIO_FINISH(req) ((req)->finish) && !EIO_CANCELLED (req) ? (req)->finish (req) : 0
95 98
96#define EIO_ENOSYS() EIO_ERRNO (ENOSYS, -1) 99#define EIO_ENOSYS() EIO_ERRNO (ENOSYS, -1)
97 100
98#ifdef _WIN32 101#ifdef _WIN32
99 102
103 #undef PAGESIZE
100 #define PAGESIZE 4096 /* GetSystemInfo? */ 104 #define PAGESIZE 4096 /* GetSystemInfo? */
101 105
102 #ifdef EIO_STRUCT_STATI64 106 #ifdef EIO_STRUCT_STATI64
103 #define stat(path,buf) _stati64 (path,buf) 107 #define stat(path,buf) _stati64 (path,buf)
104 #define fstat(fd,buf) _fstati64 (path,buf) 108 #define fstat(fd,buf) _fstati64 (path,buf)
105 #endif 109 #endif
106 #define lstat(path,buf) stat (path,buf) 110 #define lstat(path,buf) stat (path,buf)
107 #define fsync(fd) (FlushFileBuffers (EIO_FD_TO_WIN32_HANDLE (fd)) ? 0 : EIO_ERRNO (EBADF, -1)) 111 #define fsync(fd) (FlushFileBuffers ((HANDLE)EIO_FD_TO_WIN32_HANDLE (fd)) ? 0 : EIO_ERRNO (EBADF, -1))
108 #define mkdir(path,mode) _mkdir (path) 112 #define mkdir(path,mode) _mkdir (path)
109 #define link(old,neu) (CreateHardLink (neu, old, 0) ? 0 : EIO_ERRNO (ENOENT, -1)) 113 #define link(old,neu) (CreateHardLink (neu, old, 0) ? 0 : EIO_ERRNO (ENOENT, -1))
110 114
115 #define chmod(path,mode) _chmod (path, mode)
116 #define fchmod(fd,mode) EIO_ENOSYS ()
111 #define chown(path,uid,gid) EIO_ENOSYS () 117 #define chown(path,uid,gid) EIO_ENOSYS ()
112 #define fchown(fd,uid,gid) EIO_ENOSYS () 118 #define fchown(fd,uid,gid) EIO_ENOSYS ()
113 #define truncate(path,offs) EIO_ENOSYS () /* far-miss: SetEndOfFile */ 119 #define truncate(path,offs) EIO_ENOSYS () /* far-miss: SetEndOfFile */
114 #define ftruncate(fd,offs) EIO_ENOSYS () /* near-miss: SetEndOfFile */ 120 #define ftruncate(fd,offs) EIO_ENOSYS () /* near-miss: SetEndOfFile */
115 #define mknod(path,mode,dev) EIO_ENOSYS () 121 #define mknod(path,mode,dev) EIO_ENOSYS ()
116 #define sync() EIO_ENOSYS () 122 #define sync() EIO_ENOSYS ()
123 #define readlink(path,buf,s) EIO_ENOSYS ()
124 #define statvfs(path,buf) EIO_ENOSYS ()
125 #define fstatvfs(fd,buf) EIO_ENOSYS ()
117 126
118 /* we could even stat and see if it exists */ 127 /* we could even stat and see if it exists */
119 static int 128 static int
120 symlink (const char *old, const char *neu) 129 symlink (const char *old, const char *neu)
121 { 130 {
131 #if WINVER >= 0x0600
122 if (CreateSymbolicLink (neu, old, 1)) 132 if (CreateSymbolicLink (neu, old, 1))
123 return 0; 133 return 0;
124 134
125 if (CreateSymbolicLink (neu, old, 0)) 135 if (CreateSymbolicLink (neu, old, 0))
126 return 0; 136 return 0;
137 #endif
127 138
128 return EIO_ERRNO (ENOENT, -1); 139 return EIO_ERRNO (ENOENT, -1);
129 } 140 }
141
142 /* POSIX API only */
143 #define CreateHardLink(neu,old) 0
144 #define CreateSymbolicLink(neu,old,flags) 0
145
146 struct statvfs
147 {
148 int dummy;
149 };
130 150
131#else 151#else
132 152
133 #include <sys/time.h> 153 #include <sys/time.h>
134 #include <sys/select.h> 154 #include <sys/select.h>
1126 && (errno == ENOSYS || errno == EINVAL || errno == ENOTSOCK 1146 && (errno == ENOSYS || errno == EINVAL || errno == ENOTSOCK
1127 /* BSDs */ 1147 /* BSDs */
1128#ifdef ENOTSUP /* sigh, if the steenking pile called openbsd would only try to at least compile posix code... */ 1148#ifdef ENOTSUP /* sigh, if the steenking pile called openbsd would only try to at least compile posix code... */
1129 || errno == ENOTSUP 1149 || errno == ENOTSUP
1130#endif 1150#endif
1151#ifdef EOPNOTSUPP /* windows */
1131 || errno == EOPNOTSUPP /* BSDs */ 1152 || errno == EOPNOTSUPP /* BSDs */
1153#endif
1132#if __solaris 1154#if __solaris
1133 || errno == EAFNOSUPPORT || errno == EPROTOTYPE 1155 || errno == EAFNOSUPPORT || errno == EPROTOTYPE
1134#endif 1156#endif
1135 ) 1157 )
1136 ) 1158 )

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines