Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(654)

Side by Side Diff: runtime/bin/socket_linux.cc

Issue 154273003: Make std* blocking file-descriptors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_LINUX) 6 #if defined(TARGET_OS_LINUX)
7 7
8 #include <errno.h> // NOLINT 8 #include <errno.h> // NOLINT
9 #include <stdio.h> // NOLINT 9 #include <stdio.h> // NOLINT
10 #include <stdlib.h> // NOLINT 10 #include <stdlib.h> // NOLINT
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 int result = fstat64(fd, &buf); 219 int result = fstat64(fd, &buf);
220 if (result == -1) return -1; 220 if (result == -1) return -1;
221 if (S_ISCHR(buf.st_mode)) return File::kTerminal; 221 if (S_ISCHR(buf.st_mode)) return File::kTerminal;
222 if (S_ISFIFO(buf.st_mode)) return File::kPipe; 222 if (S_ISFIFO(buf.st_mode)) return File::kPipe;
223 if (S_ISREG(buf.st_mode)) return File::kFile; 223 if (S_ISREG(buf.st_mode)) return File::kFile;
224 return File::kOther; 224 return File::kOther;
225 } 225 }
226 226
227 227
228 intptr_t Socket::GetStdioHandle(intptr_t num) { 228 intptr_t Socket::GetStdioHandle(intptr_t num) {
229 Socket::SetNonBlocking(num);
230 return num; 229 return num;
231 } 230 }
232 231
233 232
234 AddressList<SocketAddress>* Socket::LookupAddress(const char* host, 233 AddressList<SocketAddress>* Socket::LookupAddress(const char* host,
235 int type, 234 int type,
236 OSError** os_error) { 235 OSError** os_error) {
237 // Perform a name lookup for a host name. 236 // Perform a name lookup for a host name.
238 struct addrinfo hints; 237 struct addrinfo hints;
239 memset(&hints, 0, sizeof(hints)); 238 memset(&hints, 0, sizeof(hints));
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 mreq.gr_interface = interfaceIndex; 617 mreq.gr_interface = interfaceIndex;
619 memmove(&mreq.gr_group, &addr->ss, SocketAddress::GetAddrLength(addr)); 618 memmove(&mreq.gr_group, &addr->ss, SocketAddress::GetAddrLength(addr));
620 return TEMP_FAILURE_RETRY_BLOCK_SIGNALS(setsockopt( 619 return TEMP_FAILURE_RETRY_BLOCK_SIGNALS(setsockopt(
621 fd, proto, MCAST_LEAVE_GROUP, &mreq, sizeof(mreq))) == 0; 620 fd, proto, MCAST_LEAVE_GROUP, &mreq, sizeof(mreq))) == 0;
622 } 621 }
623 622
624 } // namespace bin 623 } // namespace bin
625 } // namespace dart 624 } // namespace dart
626 625
627 #endif // defined(TARGET_OS_LINUX) 626 #endif // defined(TARGET_OS_LINUX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698