newlib/winsup/cygwin/fhandler_zero.cc
Corinna Vinschen 56551a9bfb * Use new unified status_flag accessor methods from classes fhandler_*,
tty_min, mtinfo and fs_info thoroughout.
	* fhandler.h: Redefine all set_close_on_exec methods to take a bool
	argument.
	(enum conn_state): Rename from connect_state.
	(class fhandler_base): Rename some status flags to align with
	accessor method names.  Drop encoded flag entirely.  Unify status
	accessor methods.  Const'ify all read accessor methods.
	(class fhandler_socket): Ditto.
	(class fhandler_dev_raw): Ditto.
	* fhandler_disk_file.cc (fhandler_base::fstat_fs): Use fs.fs_is_fat()
	instead of evaluating FATness of file system here.
	(fhandler_disk_file::opendir): Drop call to set_encoded().
	(fhandler_disk_file::readdir): Use pc.isencoded() directly.
	* mtinfo.h (class mtinfo_drive): Const'ify all read accessor methods.
	* path.cc (fsinfo_cnt): Add.
	(fs_info::update): Accomodate class changes. Evaluate file system
	name specific flags right here. Add thread safety for reading and
	writing global fsinfo array.
	* path.h (enum path_types): Drop values for flags kept in fs already.
	(struct fs_info): Move status informatin into private struct type
	status_flags.  Add accessor methods. Remove path and file system
	name string arrays in favor of status bits.
	(class path_conv): Use new fs_info status information where
	appropriate.
	(path_conf::fs_has_ea): Rename from fs_fast_ea.
	(path_conf::fs_has_acls): New method.
	(path_conf::root_dir): Remove.
	(path_conf::volname): Remove.
	* syscalls (statfs): Evaluate root dir locally.
	* tty.h (class tty_min): Unify status accessor methods.  Const'ify
	all read accessor methods.
2004-04-10 13:45:10 +00:00

57 lines
969 B
C++

/* fhandler_dev_zero.cc: code to access /dev/zero
Copyright 2000, 2001, 2002, 2003, 2004 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 <errno.h>
#include "security.h"
#include "path.h"
#include "fhandler.h"
fhandler_dev_zero::fhandler_dev_zero ()
: fhandler_base ()
{
}
int
fhandler_dev_zero::open (int flags, mode_t)
{
set_flags ((flags & ~O_TEXT) | O_BINARY);
nohandle (true);
set_open_status ();
return 1;
}
int
fhandler_dev_zero::write (const void *, size_t len)
{
return len;
}
void __stdcall
fhandler_dev_zero::read (void *ptr, size_t& len)
{
memset (ptr, 0, len);
return;
}
_off64_t
fhandler_dev_zero::lseek (_off64_t, int)
{
return 0;
}
void
fhandler_dev_zero::dump ()
{
paranoid_printf ("here, fhandler_dev_zero");
}