* devices.h: Switch FH_ZERO and FH_PORT as on Linux. Add FH_FULL.

* devices.in: Add /dev/full.
	* devices.cc: Regenerate.
	* dtable.cc (build_fh_pc): Add FH_FULL.
	* fhandler.cc (fhandler_base::fstat): Set FH_FULL permission bits
	correctly.
	* fhandler_zero.cc (fhandler_dev_zero::write): Set errno to ENOSPC
	and return -1 if device is FH_FULL.
This commit is contained in:
Corinna Vinschen 2005-02-23 12:30:31 +00:00
parent 4add0a4e2f
commit e5ef74dfb2
7 changed files with 861 additions and 814 deletions

View file

@ -1,3 +1,14 @@
2005-02-23 Corinna Vinschen <corinna@vinschen.de>
* devices.h: Switch FH_ZERO and FH_PORT as on Linux. Add FH_FULL.
* devices.in: Add /dev/full.
* devices.cc: Regenerate.
* dtable.cc (build_fh_pc): Add FH_FULL.
* fhandler.cc (fhandler_base::fstat): Set FH_FULL permission bits
correctly.
* fhandler_zero.cc (fhandler_dev_zero::write): Set errno to ENOSPC
and return -1 if device is FH_FULL.
2005-02-22 Christopher Faylor <cgf@timesys.com>
* fhandler_disk_file.cc (fhandler_cygdrive::closedir): Return 0 when

File diff suppressed because it is too large Load diff

View file

@ -94,8 +94,9 @@ enum fh_devices
FH_MEM = FHDEV (1, 1),
FH_KMEM = FHDEV (1, 2), /* not implemented yet */
FH_NULL = FHDEV (1, 3),
FH_ZERO = FHDEV (1, 4),
FH_PORT = FHDEV (1, 5),
FH_PORT = FHDEV (1, 4),
FH_ZERO = FHDEV (1, 5),
FH_FULL = FHDEV (1, 7),
FH_RANDOM = FHDEV (1, 8),
FH_URANDOM = FHDEV (1, 9),
FH_OSS_DSP = FHDEV (14, 3),

View file

@ -59,6 +59,7 @@ const device dev_bad_storage =
"/dev/conout", FH_CONOUT, "conout"
"/dev/null", FH_NULL, "nul"
"/dev/zero", FH_ZERO, "\\dev\\zero"
"/dev/full", FH_FULL, "\\dev\\full"
"/dev/random", FH_RANDOM, "\\dev\\random"
"/dev/urandom", FH_URANDOM, "\\dev\\urandom", urandom_dev
"/dev/mem", FH_MEM, "\\dev\\mem"

View file

@ -428,6 +428,7 @@ build_fh_pc (path_conv& pc)
fh = cnew (fhandler_dev_null) ();
break;
case FH_ZERO:
case FH_FULL:
fh = cnew (fhandler_dev_zero) ();
break;
case FH_RANDOM:

View file

@ -1211,6 +1211,9 @@ fhandler_base::fstat (struct __stat64 *buf)
case FH_PIPER:
buf->st_mode = S_IFIFO | STD_RBITS;
break;
case FH_FULL:
buf->st_mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IWGRP | S_IWOTH;
break;
default:
buf->st_mode = S_IFCHR | STD_RBITS | STD_WBITS | S_IWGRP | S_IWOTH;
break;

View file

@ -34,6 +34,11 @@ fhandler_dev_zero::open (int flags, mode_t)
int
fhandler_dev_zero::write (const void *, size_t len)
{
if (get_device () == FH_FULL)
{
set_errno (ENOSPC);
return -1;
}
return len;
}