Changeset 4322
- Timestamp:
- 03/12/09 15:53:52 (4 years ago)
- Location:
- luci/trunk/libs/nixio/src
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
luci/trunk/libs/nixio/src/address.c
r4287 r4322 21 21 #include <sys/socket.h> 22 22 #include <arpa/inet.h> 23 #include <netinet/in.h> 23 24 #include <string.h> 24 25 #include <netdb.h> -
luci/trunk/libs/nixio/src/bind.c
r4287 r4322 21 21 #include <sys/socket.h> 22 22 #include <arpa/inet.h> 23 #include <netinet/in.h> 23 24 #include <sys/un.h> 24 25 #include <string.h> … … 26 27 #include <netdb.h> 27 28 #include <errno.h> 28 #include "nixio.h"29 29 30 30 /** -
luci/trunk/libs/nixio/src/file.c
r4287 r4322 26 26 #include <sys/types.h> 27 27 #include <sys/stat.h> 28 #include <sys/param.h> 28 29 29 30 … … 210 211 static int nixio_file_sync(lua_State *L) { 211 212 int fd = nixio__checkfd(L, 1); 213 #ifndef BSD 212 214 int meta = lua_toboolean(L, 2); 213 215 return nixio__pstatus(L, (meta) ? !fsync(fd) : !fdatasync(fd)); 216 #else 217 return nixio__pstatus(L, !fsync(fd)); 218 #endif 214 219 } 215 220 -
luci/trunk/libs/nixio/src/io.c
r4281 r4322 24 24 #include <sys/socket.h> 25 25 #include <arpa/inet.h> 26 #include "nixio.h" 27 26 #include <netinet/in.h> 28 27 29 28 -
luci/trunk/libs/nixio/src/splice.c
r4312 r4322 26 26 #include <errno.h> 27 27 #include <unistd.h> 28 29 #ifndef BSD 28 30 #include <sys/sendfile.h> 31 #else 32 #include <sys/types.h> 33 #include <sys/socket.h> 34 #include <sys/uio.h> 35 #endif 29 36 30 37 #ifdef _GNU_SOURCE … … 103 110 */ 104 111 static int nixio_sendfile(lua_State *L) { 105 int sock fd= nixio__checksockfd(L);112 int sock = nixio__checksockfd(L); 106 113 int infd = nixio__checkfd(L, 2); 107 114 size_t len = luaL_checkinteger(L, 3); 115 off_t spliced; 108 116 109 long spliced = sendfile(sockfd, infd, NULL, len); 117 #ifndef BSD 118 do { 119 spliced = sendfile(sock, infd, NULL, len); 120 } while (spliced == -1 && errno == EINTR); 110 121 111 if (spliced < 0) {122 if (spliced == -1) { 112 123 return nixio__perror(L); 113 124 } 125 #else 126 int r; 127 const off_t offset = lseek(infd, 0, SEEK_CUR); 128 129 do { 130 r = sendfile(infd, sock, offset, len, NULL, &spliced, 0); 131 } while (r == -1 && errno == EINTR); 132 133 if (r == -1) { 134 return nixio__perror(L); 135 } 136 #endif 114 137 115 138 lua_pushnumber(L, spliced);
