* 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:
Christopher Faylor 2008-01-01 18:51:23 +00:00
parent b918632a2a
commit 8528ecbde8
5 changed files with 2799 additions and 2808 deletions

File diff suppressed because it is too large Load Diff

2769
winsup/cygwin/ChangeLog-2007 Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
lib=$1; shift lib=$1; shift
as=$1; shift as=$1; shift
ar=$1; shift ar=$1; shift
@ -8,17 +8,23 @@ mkdir newsym.dir
while [ -n "$1" ]; do while [ -n "$1" ]; do
newsym=$1; shift newsym=$1; shift
oldsym=$1; shift oldsym=$1; shift
cat <<EOF > newsym.dir/$newsym.s if [[ "$newsym" = *:d ]]; then
.section .text newsym=${newsym%:d}
else
cat <<EOF
.text
.global _$newsym .global _$newsym
.global __imp__$newsym
_$newsym: _$newsym:
jmp *__imp__$oldsym jmp *__imp__$oldsym
EOF
fi > newsym.dir/$newsym.s
cat <<EOF >> newsym.dir/$newsym.s
.section .idata\$7 .section .idata\$7
.long __head_cygwin1_dll .long __head_cygwin1_dll
.section .idata\$5 .section .idata\$5
.global __imp__$newsym
__imp__$newsym: .rva 1f __imp__$newsym: .rva 1f
.section .idata\$4 .section .idata\$4

View File

@ -156,7 +156,7 @@ out:
#define WINPIPE "\\\\.\\pipe\\" #define WINPIPE "\\\\.\\pipe\\"
void 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 // FIXME: Have to clean this up someday
if (!*get_win32_name () && get_name ()) if (!*get_win32_name () && get_name ())
@ -181,7 +181,9 @@ fhandler_pipe::init (HANDLE f, DWORD a, mode_t bin)
f = ps.ret_handle; 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 (); setup_overlapped ();
} }
@ -424,25 +426,22 @@ fhandler_pipe::create (fhandler_pipe *fhs[2], unsigned psize, int mode)
{ {
HANDLE r, w; HANDLE r, w;
SECURITY_ATTRIBUTES *sa = (mode & O_NOINHERIT) ? &sec_none_nih : &sec_none; SECURITY_ATTRIBUTES *sa = (mode & O_NOINHERIT) ? &sec_none_nih : &sec_none;
int res = -1; int res;
int ret = create_selectable (sa, r, w, psize); int ret = create_selectable (sa, r, w, psize);
if (ret) if (ret)
{
__seterrno_from_win_error (ret); __seterrno_from_win_error (ret);
res = -1;
}
else else
{ {
fhs[0] = (fhandler_pipe *) build_fh_dev (*piper_dev); fhs[0] = (fhandler_pipe *) build_fh_dev (*piper_dev);
fhs[1] = (fhandler_pipe *) build_fh_dev (*pipew_dev); fhs[1] = (fhandler_pipe *) build_fh_dev (*pipew_dev);
int binmode = mode & O_TEXT ?: O_BINARY; mode |= mode & O_TEXT ?: O_BINARY;
fhs[0]->init (r, FILE_CREATE_PIPE_INSTANCE | GENERIC_READ, binmode); fhs[0]->init (r, FILE_CREATE_PIPE_INSTANCE | GENERIC_READ, mode);
fhs[1]->init (w, FILE_CREATE_PIPE_INSTANCE | GENERIC_WRITE, binmode); fhs[1]->init (w, FILE_CREATE_PIPE_INSTANCE | GENERIC_WRITE, mode);
if (mode & O_NOINHERIT)
{
fhs[0]->close_on_exec (true);
fhs[1]->close_on_exec (true);
}
res = 0; res = 0;
} }

View File

@ -226,33 +226,10 @@ tty_list::allocate (bool with_console)
if (!with_console) if (!with_console)
console = NULL; console = NULL;
else if (!(console = GetConsoleWindow ())) 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"); termios_printf ("Can't find console window");
goto out; goto out;
} }
}
/* Is a tty allocated for console? */ /* Is a tty allocated for console? */
for (int i = 0; i < NTTYS; i++) for (int i = 0; i < NTTYS; i++)