-
Notifications
You must be signed in to change notification settings - Fork 33
/
dev_null.h
51 lines (37 loc) · 1.08 KB
/
dev_null.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2012 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef DEV_NULL_H
#define DEV_NULL_H
#include "file_interfaces.h"
#include "pthread_helpers.h"
class DevNullHandler : public PathHandler {
public:
DevNullHandler();
virtual ~DevNullHandler();
virtual void addref();
virtual void release();
virtual FileStream* open(int fd, const char* pathname, int oflag, int* err);
virtual int stat(const char* pathname, nacl_abi_stat* out);
private:
int ref_;
DISALLOW_COPY_AND_ASSIGN(DevNullHandler);
};
class DevNull : public FileStream {
public:
DevNull(int fd, int oflag);
virtual ~DevNull();
virtual void addref();
virtual void release();
virtual FileStream* dup(int fd);
virtual void close();
virtual int read(char* buf, size_t count, size_t* nread);
virtual int write(const char* buf, size_t count, size_t* nwrote);
virtual int fcntl(int cmd, va_list ap);
private:
int fd_;
int oflag_;
int ref_;
DISALLOW_COPY_AND_ASSIGN(DevNull);
};
#endif // DEV_NULL_H