mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-13 04:29:09 +08:00
Cygwin: fhandler_base::set_name_from _handle: new method
This is based on a new static member function dtable::handle_to_fn, which was previously a static function in dtable.cc.
This commit is contained in:
parent
91ce3d3fd7
commit
b9feec71ff
@ -31,8 +31,6 @@ details. */
|
|||||||
static const DWORD std_consts[] = {STD_INPUT_HANDLE, STD_OUTPUT_HANDLE,
|
static const DWORD std_consts[] = {STD_INPUT_HANDLE, STD_OUTPUT_HANDLE,
|
||||||
STD_ERROR_HANDLE};
|
STD_ERROR_HANDLE};
|
||||||
|
|
||||||
static bool handle_to_fn (HANDLE, char *);
|
|
||||||
|
|
||||||
#define WCLEN(x) ((sizeof (x) / sizeof (WCHAR)) - 1)
|
#define WCLEN(x) ((sizeof (x) / sizeof (WCHAR)) - 1)
|
||||||
static const char unknown_file[] = "some disk file";
|
static const char unknown_file[] = "some disk file";
|
||||||
static const WCHAR DEV_NULL[] = L"\\Device\\Null";
|
static const WCHAR DEV_NULL[] = L"\\Device\\Null";
|
||||||
@ -937,8 +935,8 @@ decode_tty (char *buf, WCHAR *w32)
|
|||||||
|
|
||||||
/* Try to derive posix filename from given handle. Return true if
|
/* Try to derive posix filename from given handle. Return true if
|
||||||
the handle is associated with a cygwin tty. */
|
the handle is associated with a cygwin tty. */
|
||||||
static bool
|
bool
|
||||||
handle_to_fn (HANDLE h, char *posix_fn)
|
dtable::handle_to_fn (HANDLE h, char *posix_fn)
|
||||||
{
|
{
|
||||||
tmp_pathbuf tp;
|
tmp_pathbuf tp;
|
||||||
ULONG len = 0;
|
ULONG len = 0;
|
||||||
|
@ -78,6 +78,8 @@ public:
|
|||||||
void fixup_before_fork (DWORD win_proc_id);
|
void fixup_before_fork (DWORD win_proc_id);
|
||||||
void lock () {lock_process::locker.acquire ();}
|
void lock () {lock_process::locker.acquire ();}
|
||||||
void unlock () {lock_process::locker.release ();}
|
void unlock () {lock_process::locker.release ();}
|
||||||
|
|
||||||
|
static bool handle_to_fn (HANDLE, char *);
|
||||||
};
|
};
|
||||||
|
|
||||||
fhandler_base *build_fh_dev (const device&, const char * = NULL);
|
fhandler_base *build_fh_dev (const device&, const char * = NULL);
|
||||||
|
@ -29,6 +29,7 @@ details. */
|
|||||||
#include "shared_info.h"
|
#include "shared_info.h"
|
||||||
#include <asm/socket.h>
|
#include <asm/socket.h>
|
||||||
#include "cygwait.h"
|
#include "cygwait.h"
|
||||||
|
#include "tls_pbuf.h"
|
||||||
|
|
||||||
#define MAX_OVERLAPPED_WRITE_LEN (64 * 1024 * 1024)
|
#define MAX_OVERLAPPED_WRITE_LEN (64 * 1024 * 1024)
|
||||||
#define MIN_OVERLAPPED_WRITE_LEN (1 * 1024 * 1024)
|
#define MIN_OVERLAPPED_WRITE_LEN (1 * 1024 * 1024)
|
||||||
@ -135,6 +136,18 @@ fhandler_base::set_name (path_conv &in_pc)
|
|||||||
pc << in_pc;
|
pc << in_pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Preliminary version. */
|
||||||
|
void
|
||||||
|
fhandler_base::set_name_from_handle ()
|
||||||
|
{
|
||||||
|
tmp_pathbuf tp;
|
||||||
|
char *name = tp.c_get ();
|
||||||
|
|
||||||
|
name[0] = '\0';
|
||||||
|
dtable::handle_to_fn (get_handle (), name);
|
||||||
|
set_name (cstrdup (name));
|
||||||
|
}
|
||||||
|
|
||||||
char *fhandler_base::get_proc_fd_name (char *buf)
|
char *fhandler_base::get_proc_fd_name (char *buf)
|
||||||
{
|
{
|
||||||
IO_STATUS_BLOCK io;
|
IO_STATUS_BLOCK io;
|
||||||
|
@ -237,6 +237,7 @@ class fhandler_base
|
|||||||
pc.set_posix (s);
|
pc.set_posix (s);
|
||||||
pc.set_path (s);
|
pc.set_path (s);
|
||||||
}
|
}
|
||||||
|
virtual void set_name_from_handle ();
|
||||||
int error () const {return pc.error;}
|
int error () const {return pc.error;}
|
||||||
void set_error (int error) {pc.error = error;}
|
void set_error (int error) {pc.error = error;}
|
||||||
bool exists () const {return pc.exists ();}
|
bool exists () const {return pc.exists ();}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user