dart-sdk/runtime/bin/fdutils.h
ager@google.com 607eea1402 Cleanup gypi mess.
My change that introduced a platform directory shared between vm and bin runtime components did not correctly update gypi files.

BUG=
TEST=

Review URL: http://codereview.chromium.org//9124030

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3155 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-10 16:50:14 +00:00

41 lines
1.5 KiB
C++

// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef BIN_FDUTILS_H_
#define BIN_FDUTILS_H_
#include "bin/builtin.h"
#include "platform/globals.h"
class FDUtils {
public:
static bool SetNonBlocking(intptr_t fd);
// Checks whether the file descriptor is blocking. If the function
// returns true the value pointed to by is_blocking will be set to
// the blocking state of the file descriptor. If the function
// returns false the system call for checking the file descriptor
// failed and the value pointed to by is_blocking is not modified.
static bool IsBlocking(intptr_t fd, bool* is_blocking);
static intptr_t AvailableBytes(intptr_t fd);
// Reads the requested number of bytes from a file descriptor. This
// function will only return on short reads if an error occours in
// which case it returns -1 and errno is still valid. The file
// descriptor must be in blocking mode.
static ssize_t ReadFromBlocking(int fd, void* buffer, size_t count);
// Writes the requested number of bytes to a file descriptor. This
// function will only return on short writes if an error occours in
// which case it returns -1 and errno is still valid. The file
// descriptor must be in blocking mode.
static ssize_t WriteToBlocking(int fd, const void* buffer, size_t count);
private:
DISALLOW_ALLOCATION();
DISALLOW_IMPLICIT_CONSTRUCTORS(FDUtils);
};
#endif // BIN_FDUTILS_H_