newlib/winsup/cygwin/fhandler_zero.cc
Corinna Vinschen 8ef76ab6f9 * fhandler.h (fhandler_dev_zero::lseek): Convert to inline method.
(class fhandler_dev_random): Drop dummy_offset.
	(fhandler_dev_random::lseek): Convert to inline method.
	(fhandler_dev_dsp::lseek): Ditto.
	* fhandler_dsp.cc (fhandler_dev_dsp::lseek): Drop here.
	* fhandler_random.cc (fhandler_dev_random::open): Drop setting
	dummy_offset.
	(fhandler_dev_random::lseek): Drop here.
	* fhandler_tape.cc (fhandler_dev_tape::lseek): Make no-op, but keep
	old code for reference.
	* fhandler_zero.cc (fhandler_dev_zero::lseek): Drop here.
2013-10-24 17:51:41 +00:00

40 lines
783 B
C++

/* fhandler_dev_zero.cc: code to access /dev/zero
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013 Red Hat, Inc.
Written by DJ Delorie (dj@cygnus.com)
This file is part of Cygwin.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
#include "security.h"
#include "cygerrno.h"
#include "path.h"
#include "fhandler.h"
fhandler_dev_zero::fhandler_dev_zero ()
: fhandler_base ()
{
}
ssize_t __stdcall
fhandler_dev_zero::write (const void *, size_t len)
{
if (get_device () == FH_FULL)
{
set_errno (ENOSPC);
return -1;
}
return len;
}
void __reg3
fhandler_dev_zero::read (void *ptr, size_t& len)
{
memset (ptr, 0, len);
}