f3ea62a847
* fhandler.h (fhandler_base::set_open_status): New method. Stores original open status. (fhandler_base::get_open_status): New method. Retrieves original open status. (fhandler_base::reset_to_open_binmode): New method. * fhandler.cc (fhandler_base::open): Save open status. (fhandler_base::init): Ditto. * fhandler_clipboard.cc (fhandler_clipboard::open): Ditto. * fhandler_console.cc (fhandler_console::open): Ditto. * fhandler_dsp.cc (fhandler_dsp::open): Ditto. * fhandler_dev_mem.cc (fhandler_dev_mem::open): Ditto. * fhandler_dev_random.cc (fhandler_dev_random::open): Ditto. * fhandler_serial.cc (fhandler_serial::open): Ditto. * fhandler_tty_slave.cc (fhandler_tty_slave::open): Ditto. * fhandler_tty_master.cc (fhandler_tty_master::open): Ditto. * fhandler_dev_zero.cc (fhandler_dev_zero::open): Ditto. * syscalls.cc (setmode): Rework so that 0 mode value causes reversion to open state. * fhandler_tty_slave.cc (fhandler_tty_slave::read): Use correct multiplier when converting from deciseconds to milliseconds.
61 lines
972 B
C++
61 lines
972 B
C++
/* fhandler_dev_zero.cc: code to access /dev/zero
|
|
|
|
Copyright 2000 Cygnus Solutions.
|
|
|
|
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 <errno.h>
|
|
#include "fhandler.h"
|
|
|
|
fhandler_dev_zero::fhandler_dev_zero (const char *name)
|
|
: fhandler_base (FH_ZERO, name)
|
|
{
|
|
set_cb (sizeof *this);
|
|
}
|
|
|
|
int
|
|
fhandler_dev_zero::open (const char *, int flags, mode_t)
|
|
{
|
|
set_flags (flags);
|
|
set_open_status ();
|
|
return 1;
|
|
}
|
|
|
|
int
|
|
fhandler_dev_zero::write (const void *, size_t len)
|
|
{
|
|
return len;
|
|
}
|
|
|
|
int
|
|
fhandler_dev_zero::read (void *ptr, size_t len)
|
|
{
|
|
memset(ptr, 0, len);
|
|
return len;
|
|
}
|
|
|
|
off_t
|
|
fhandler_dev_zero::lseek (off_t, int)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
int
|
|
fhandler_dev_zero::close (void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
void
|
|
fhandler_dev_zero::dump ()
|
|
{
|
|
paranoid_printf("here, fhandler_dev_zero");
|
|
}
|