* newsym: First stab at understanding data as well as functions.
* pipe.cc (fhandler_pipe::init): Move more intelligence here. (fhandler_pipe::create): Simplify based on above change. * tty.cc (tty_list::allocate): Remove non-NT code.
This commit is contained in:
parent
b918632a2a
commit
8528ecbde8
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
lib=$1; shift
|
||||
as=$1; shift
|
||||
ar=$1; shift
|
||||
|
@ -8,17 +8,23 @@ mkdir newsym.dir
|
|||
while [ -n "$1" ]; do
|
||||
newsym=$1; shift
|
||||
oldsym=$1; shift
|
||||
cat <<EOF > newsym.dir/$newsym.s
|
||||
.section .text
|
||||
if [[ "$newsym" = *:d ]]; then
|
||||
newsym=${newsym%:d}
|
||||
else
|
||||
cat <<EOF
|
||||
.text
|
||||
.global _$newsym
|
||||
.global __imp__$newsym
|
||||
_$newsym:
|
||||
jmp *__imp__$oldsym
|
||||
EOF
|
||||
fi > newsym.dir/$newsym.s
|
||||
|
||||
cat <<EOF >> newsym.dir/$newsym.s
|
||||
.section .idata\$7
|
||||
.long __head_cygwin1_dll
|
||||
|
||||
.section .idata\$5
|
||||
.section .idata\$5
|
||||
.global __imp__$newsym
|
||||
__imp__$newsym: .rva 1f
|
||||
|
||||
.section .idata\$4
|
||||
|
|
|
@ -156,7 +156,7 @@ out:
|
|||
|
||||
#define WINPIPE "\\\\.\\pipe\\"
|
||||
void
|
||||
fhandler_pipe::init (HANDLE f, DWORD a, mode_t bin)
|
||||
fhandler_pipe::init (HANDLE f, DWORD a, mode_t mode)
|
||||
{
|
||||
// FIXME: Have to clean this up someday
|
||||
if (!*get_win32_name () && get_name ())
|
||||
|
@ -181,7 +181,9 @@ fhandler_pipe::init (HANDLE f, DWORD a, mode_t bin)
|
|||
f = ps.ret_handle;
|
||||
}
|
||||
|
||||
fhandler_base::init (f, a, bin);
|
||||
fhandler_base::init (f, a, mode);
|
||||
if (mode & O_NOINHERIT)
|
||||
close_on_exec (true);
|
||||
setup_overlapped ();
|
||||
}
|
||||
|
||||
|
@ -424,25 +426,22 @@ fhandler_pipe::create (fhandler_pipe *fhs[2], unsigned psize, int mode)
|
|||
{
|
||||
HANDLE r, w;
|
||||
SECURITY_ATTRIBUTES *sa = (mode & O_NOINHERIT) ? &sec_none_nih : &sec_none;
|
||||
int res = -1;
|
||||
int res;
|
||||
|
||||
int ret = create_selectable (sa, r, w, psize);
|
||||
if (ret)
|
||||
__seterrno_from_win_error (ret);
|
||||
{
|
||||
__seterrno_from_win_error (ret);
|
||||
res = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
fhs[0] = (fhandler_pipe *) build_fh_dev (*piper_dev);
|
||||
fhs[1] = (fhandler_pipe *) build_fh_dev (*pipew_dev);
|
||||
|
||||
int binmode = mode & O_TEXT ?: O_BINARY;
|
||||
fhs[0]->init (r, FILE_CREATE_PIPE_INSTANCE | GENERIC_READ, binmode);
|
||||
fhs[1]->init (w, FILE_CREATE_PIPE_INSTANCE | GENERIC_WRITE, binmode);
|
||||
if (mode & O_NOINHERIT)
|
||||
{
|
||||
fhs[0]->close_on_exec (true);
|
||||
fhs[1]->close_on_exec (true);
|
||||
}
|
||||
|
||||
mode |= mode & O_TEXT ?: O_BINARY;
|
||||
fhs[0]->init (r, FILE_CREATE_PIPE_INSTANCE | GENERIC_READ, mode);
|
||||
fhs[1]->init (w, FILE_CREATE_PIPE_INSTANCE | GENERIC_WRITE, mode);
|
||||
res = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -227,31 +227,8 @@ tty_list::allocate (bool with_console)
|
|||
console = NULL;
|
||||
else if (!(console = GetConsoleWindow ()))
|
||||
{
|
||||
char oldtitle[TITLESIZE];
|
||||
|
||||
if (!GetConsoleTitle (oldtitle, TITLESIZE))
|
||||
{
|
||||
termios_printf ("Can't read console title");
|
||||
goto out;
|
||||
}
|
||||
|
||||
char buf[40];
|
||||
|
||||
__small_sprintf (buf, "cygwin.find.console.%d", myself->pid);
|
||||
SetConsoleTitle (buf);
|
||||
for (int times = 0; times < 25; times++)
|
||||
{
|
||||
Sleep (10);
|
||||
if ((console = FindWindow (NULL, buf)))
|
||||
break;
|
||||
}
|
||||
SetConsoleTitle (oldtitle);
|
||||
Sleep (40);
|
||||
if (console == NULL)
|
||||
{
|
||||
termios_printf ("Can't find console window");
|
||||
goto out;
|
||||
}
|
||||
termios_printf ("Can't find console window");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Is a tty allocated for console? */
|
||||
|
|
Loading…
Reference in New Issue