mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- Invoking fstat() on what maps to a con-handler stream now produces
information identifying it as a character special file. Side-effect: if the input/output went to a CON:/AUTO window, that window will pop open and stay open. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14910 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -29,6 +29,11 @@
|
||||
descriptors now work like the "real" ones. This is true even if
|
||||
the "real" ones were closed and only their former aliases remain.
|
||||
|
||||
- Invoking fstat() on what maps to a con-handler stream now produces
|
||||
information identifying it as a character special file. Side-effect:
|
||||
if the input/output went to a CON:/AUTO window, that window will
|
||||
pop open and stay open.
|
||||
|
||||
|
||||
c.lib 1.190 (25.3.2005)
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stat.h,v 1.4 2005-03-10 11:40:57 obarthel Exp $
|
||||
* $Id: stat.h,v 1.5 2005-04-02 13:25:55 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -88,22 +88,23 @@ extern "C" {
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define S_IFMT 0170000 /* type of file */
|
||||
#define S_IFIFO 0010000 /* named pipe (fifo) */
|
||||
#define S_IFDIR 0040000 /* directory */
|
||||
#define S_IFBLK 0060000 /* block special */
|
||||
#define S_IFREG 0100000 /* regular */
|
||||
#define S_IFLNK 0120000 /* symbolic link */
|
||||
#define S_IFSOCK 0140000 /* socket */
|
||||
#define S_IFMT 0170000 /* type of file */
|
||||
#define S_IFIFO 0010000 /* named pipe (fifo) */
|
||||
#define S_IFCHR 0020000 /* character special */
|
||||
#define S_IFDIR 0040000 /* directory */
|
||||
#define S_IFBLK 0060000 /* block special */
|
||||
#define S_IFREG 0100000 /* regular */
|
||||
#define S_IFLNK 0120000 /* symbolic link */
|
||||
#define S_IFSOCK 0140000 /* socket */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* directory */
|
||||
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* char special */
|
||||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* regular file */
|
||||
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) /* symbolic link */
|
||||
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* fifo */
|
||||
#define S_ISBLK(m) (0) /* block special */
|
||||
#define S_ISCHR(m) (0) /* character special */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stat_convertfileinfo.c,v 1.6 2005-01-30 09:37:59 obarthel Exp $
|
||||
* $Id: stat_convertfileinfo.c,v 1.7 2005-04-02 13:25:53 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -81,6 +81,8 @@ __convert_file_info_to_stat(
|
||||
mode = S_IFIFO;
|
||||
else if (fib->fib_DirEntryType == ST_SOCKET)
|
||||
mode = S_IFSOCK;
|
||||
else if (fib->fib_DirEntryType == ST_CONSOLE)
|
||||
mode = S_IFCHR;
|
||||
else if (fib->fib_DirEntryType < 0)
|
||||
mode = S_IFREG;
|
||||
else
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_fdhookentry.c,v 1.25 2005-04-01 18:46:37 obarthel Exp $
|
||||
* $Id: stdio_fdhookentry.c,v 1.26 2005-04-02 13:25:53 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -52,6 +52,16 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef ID_CON
|
||||
#define ID_CON (0x434F4E00L)
|
||||
#endif /* ID_CON */
|
||||
|
||||
#ifndef ID_RAWCON
|
||||
#define ID_RAWCON (0x52415700L)
|
||||
#endif /* ID_RAWCON */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
__fd_hook_entry(
|
||||
struct fd * fd,
|
||||
@ -567,16 +577,52 @@ __fd_hook_entry(
|
||||
|
||||
SHOWMSG("file_action_examine");
|
||||
|
||||
fh = BADDR(file);
|
||||
|
||||
if(CANNOT __safe_examine_file_handle(file,fam->fam_FileInfo))
|
||||
{
|
||||
SHOWMSG("couldn't examine the file");
|
||||
D_S(struct InfoData,id);
|
||||
LONG error;
|
||||
|
||||
fam->fam_Error = __translate_io_error_to_errno(IoErr());
|
||||
goto out;
|
||||
/* So that didn't work. Did the file system simply fail to
|
||||
respond to the request or is something more sinister
|
||||
at work? */
|
||||
error = IoErr();
|
||||
if(error != ERROR_ACTION_NOT_KNOWN)
|
||||
{
|
||||
SHOWMSG("couldn't examine the file");
|
||||
|
||||
fam->fam_Error = __translate_io_error_to_errno(error);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* OK, let's have another look at this file. Could it be a
|
||||
console stream? */
|
||||
if(CANNOT DoPkt(fh->fh_Type,ACTION_DISK_INFO,MKBADDR(id), 0,0,0,0))
|
||||
{
|
||||
SHOWMSG("couldn't examine the file");
|
||||
|
||||
fam->fam_Error = __translate_io_error_to_errno(IoErr());
|
||||
goto out;
|
||||
}
|
||||
|
||||
if(id->id_DiskType != ID_CON &&
|
||||
id->id_DiskType != ID_RAWCON)
|
||||
{
|
||||
SHOWMSG("whatever it is, we don't know");
|
||||
|
||||
fam->fam_Error = ENOSYS;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Make up some stuff for this stream. */
|
||||
memset(fam->fam_FileInfo,0,sizeof(*fam->fam_FileInfo));
|
||||
|
||||
DateStamp(&fam->fam_FileInfo->fib_Date);
|
||||
|
||||
fam->fam_FileInfo->fib_DirEntryType = ST_CONSOLE;
|
||||
}
|
||||
|
||||
fh = BADDR(file);
|
||||
|
||||
fam->fam_FileSystem = fh->fh_Type;
|
||||
|
||||
result = 0;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_headers.h,v 1.21 2005-03-18 12:38:23 obarthel Exp $
|
||||
* $Id: stdio_headers.h,v 1.22 2005-04-02 13:25:53 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -165,6 +165,9 @@ struct iob;
|
||||
/* The directory entry type a socket is identified with (in a FileInfoBlock). */
|
||||
#define ST_SOCKET (31082002)
|
||||
|
||||
/* The same for a console stream. */
|
||||
#define ST_CONSOLE (20050402)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Operations that can be performed by the file action function. */
|
||||
|
||||
Reference in New Issue
Block a user