Changeset 740 for vendor/current/source3/lib/packet.c
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/lib/packet.c
r591 r740 3 3 Packet handling 4 4 Copyright (C) Volker Lendecke 2007 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by 8 8 the Free Software Foundation; either version 3 of the License, or 9 9 (at your option) any later version. 10 10 11 11 This program is distributed in the hope that it will be useful, 12 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 GNU General Public License for more details. 15 15 16 16 You should have received a copy of the GNU General Public License 17 17 along with this program. If not, see <http://www.gnu.org/licenses/>. … … 19 19 20 20 #include "includes.h" 21 #include "../lib/util/select.h" 22 #include "system/filesys.h" 23 #include "system/select.h" 24 #include "packet.h" 21 25 22 26 struct packet_context { … … 102 106 } 103 107 104 NTSTATUS packet_fd_read_sync(struct packet_context *ctx, 105 struct timeval *timeout) 106 { 107 int res; 108 fd_set r_fds; 109 110 if (ctx->fd < 0 || ctx->fd >= FD_SETSIZE) { 111 errno = EBADF; 112 return map_nt_error_from_unix(errno); 113 } 114 115 FD_ZERO(&r_fds); 116 FD_SET(ctx->fd, &r_fds); 117 118 res = sys_select(ctx->fd+1, &r_fds, NULL, NULL, timeout); 119 108 NTSTATUS packet_fd_read_sync(struct packet_context *ctx, int timeout) 109 { 110 int res, revents; 111 112 res = poll_one_fd(ctx->fd, POLLIN|POLLHUP, timeout, &revents); 120 113 if (res == 0) { 121 DEBUG(10, (" selecttimed out\n"));114 DEBUG(10, ("poll timed out\n")); 122 115 return NT_STATUS_IO_TIMEOUT; 123 116 } 124 117 125 118 if (res == -1) { 126 DEBUG(10, ("select returned %s\n", strerror(errno))); 127 return map_nt_error_from_unix(errno); 119 DEBUG(10, ("poll returned %s\n", strerror(errno))); 120 return map_nt_error_from_unix(errno); 121 } 122 if ((revents & (POLLIN|POLLHUP|POLLERR)) == 0) { 123 DEBUG(10, ("socket not readable\n")); 124 return NT_STATUS_IO_TIMEOUT; 128 125 } 129 126
Note:
See TracChangeset
for help on using the changeset viewer.