]> sourceware.org Git - newlib-cygwin.git/blame - winsup/cygwin/fhandler_zero.cc
Throughout, update copyrights to reflect dates which correspond to main-branch
[newlib-cygwin.git] / winsup / cygwin / fhandler_zero.cc
CommitLineData
1fd5e000
CF
1/* fhandler_dev_zero.cc: code to access /dev/zero
2
bc837d22 3 Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 Red Hat, Inc.
1fd5e000
CF
4
5 Written by DJ Delorie (dj@cygnus.com)
6
7This file is part of Cygwin.
8
9This software is a copyrighted work licensed under the terms of the
10Cygwin license. Please consult the file "CYGWIN_LICENSE" for
11details. */
12
1fd5e000 13#include "winsup.h"
6b91b8d5 14#include "security.h"
169c465a 15#include "cygerrno.h"
7ac61736 16#include "path.h"
bccd5e0d 17#include "fhandler.h"
1fd5e000 18
0476bae5 19fhandler_dev_zero::fhandler_dev_zero ()
7ac61736 20 : fhandler_base ()
1fd5e000 21{
1fd5e000
CF
22}
23
24int
7ac61736 25fhandler_dev_zero::open (int flags, mode_t)
1fd5e000 26{
1bc9effd 27 set_flags ((flags & ~O_TEXT) | O_BINARY);
56551a9b 28 nohandle (true);
f3ea62a8 29 set_open_status ();
1fd5e000
CF
30 return 1;
31}
32
43c23d4b 33ssize_t __stdcall
9cec3d45 34fhandler_dev_zero::write (const void *, size_t len)
1fd5e000 35{
e5ef74df
CV
36 if (get_device () == FH_FULL)
37 {
38 set_errno (ENOSPC);
39 return -1;
40 }
1fd5e000
CF
41 return len;
42}
43
8bce0d72
CF
44void __stdcall
45fhandler_dev_zero::read (void *ptr, size_t& len)
1fd5e000 46{
c90e1cf1 47 memset (ptr, 0, len);
1fd5e000
CF
48}
49
1727fba0
CV
50_off64_t
51fhandler_dev_zero::lseek (_off64_t, int)
1fd5e000
CF
52{
53 return 0;
54}
This page took 0.381595 seconds and 5 git commands to generate.