* spawn.cc (av::dup_maybe): Make function void rather than void *.
* environ.cc (environ_init): Remember to reparse CYGWIN if envp is supplied. * heap.cc (_sbrk): Remember frame for signal handling. * syscalls.cc (read_handler): Eliminate. (_read): Move read_handler code here. Reorganize for one path through 'ready_for_read'.
This commit is contained in:
parent
eb69b80812
commit
fb5956da13
|
@ -1,3 +1,13 @@
|
||||||
|
2000-09-25 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
|
* spawn.cc (av::dup_maybe): Make function void rather than void *.
|
||||||
|
* environ.cc (environ_init): Remember to reparse CYGWIN if envp is
|
||||||
|
supplied.
|
||||||
|
* heap.cc (_sbrk): Remember frame for signal handling.
|
||||||
|
* syscalls.cc (read_handler): Eliminate.
|
||||||
|
(_read): Move read_handler code here. Reorganize for one path through
|
||||||
|
'ready_for_read'.
|
||||||
|
|
||||||
Tue Sep 19 09:46:36 2000 Christopher Faylor <cgf@cygnus.com>
|
Tue Sep 19 09:46:36 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* spawn.cc (spawn_guts): Use actual program argument passed in for
|
* spawn.cc (spawn_guts): Use actual program argument passed in for
|
||||||
|
@ -639,7 +649,7 @@ Wed Aug 2 13:20:04 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
* localtime.c: ditto
|
* localtime.c: ditto
|
||||||
* smallprint.c: ditto
|
* smallprint.c: ditto
|
||||||
* Makefile.in: don't __INSIDE_CYGWIN__ as it messes up profiling.
|
* Makefile.in: don't __INSIDE_CYGWIN__ as it messes up profiling.
|
||||||
|
|
||||||
Wed Aug 2 11:22:53 2000 Christopher Faylor <cgf@cygnus.com>
|
Wed Aug 2 11:22:53 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* include/sys/strace.h: Fix strace definition.
|
* include/sys/strace.h: Fix strace definition.
|
||||||
|
@ -793,7 +803,7 @@ Thu Jul 27 23:33:32 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* testsuite/winsup.api/winsup.exp: ignore stdout by default
|
* testsuite/winsup.api/winsup.exp: ignore stdout by default
|
||||||
* testsuite/winsup.api/crlf.c: non-verbose by default
|
* testsuite/winsup.api/crlf.c: non-verbose by default
|
||||||
|
|
||||||
* winsup.h: prune out windows headers we don't normally need
|
* winsup.h: prune out windows headers we don't normally need
|
||||||
* assert.cc: add wingdi.h and winuser.h
|
* assert.cc: add wingdi.h and winuser.h
|
||||||
* fhandler_console.cc: ditto
|
* fhandler_console.cc: ditto
|
||||||
|
@ -806,7 +816,7 @@ Thu Jul 27 23:33:32 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
* hinfo.cc: add winsock.h
|
* hinfo.cc: add winsock.h
|
||||||
* syscalls.cc: add winnls.h
|
* syscalls.cc: add winnls.h
|
||||||
* uinfo.cc: ditto
|
* uinfo.cc: ditto
|
||||||
|
|
||||||
Thu Jul 27 10:24:36 2000 Egor Duda <deo@logos-m.ru>
|
Thu Jul 27 10:24:36 2000 Egor Duda <deo@logos-m.ru>
|
||||||
|
|
||||||
* fhandler.cc (fhandler_disk_file::fstat): Allow block calculation to
|
* fhandler.cc (fhandler_disk_file::fstat): Allow block calculation to
|
||||||
|
|
|
@ -524,6 +524,7 @@ environ_init (char **envp)
|
||||||
char *p;
|
char *p;
|
||||||
char *newp;
|
char *newp;
|
||||||
int sawTERM = 0;
|
int sawTERM = 0;
|
||||||
|
bool envp_passed_in;
|
||||||
static char cygterm[] = "TERM=cygwin";
|
static char cygterm[] = "TERM=cygwin";
|
||||||
|
|
||||||
regopt ("default");
|
regopt ("default");
|
||||||
|
@ -536,13 +537,16 @@ environ_init (char **envp)
|
||||||
allow_ntsec = TRUE;
|
allow_ntsec = TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (envp)
|
if (!envp)
|
||||||
|
envp_passed_in = 0;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
sz = envsize (envp, 1);
|
sz = envsize (envp, 1);
|
||||||
char **newenv = (char **) malloc (sz);
|
char **newenv = (char **) malloc (sz);
|
||||||
memcpy (newenv, envp, sz);
|
memcpy (newenv, envp, sz);
|
||||||
cfree (envp);
|
cfree (envp);
|
||||||
envp = newenv;
|
envp = newenv;
|
||||||
|
envp_passed_in = 1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,6 +589,12 @@ environ_init (char **envp)
|
||||||
out:
|
out:
|
||||||
__cygwin_environ = envp;
|
__cygwin_environ = envp;
|
||||||
update_envptrs ();
|
update_envptrs ();
|
||||||
|
if (envp_passed_in)
|
||||||
|
{
|
||||||
|
p = getenv ("CYGWIN");
|
||||||
|
if (p)
|
||||||
|
parse_options (p);
|
||||||
|
}
|
||||||
parse_options (NULL);
|
parse_options (NULL);
|
||||||
MALLOC_CHECK;
|
MALLOC_CHECK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,7 @@ heap_init ()
|
||||||
extern "C" void *
|
extern "C" void *
|
||||||
_sbrk(int n)
|
_sbrk(int n)
|
||||||
{
|
{
|
||||||
|
sigframe thisframe (mainthread);
|
||||||
char *newtop, *newbrk;
|
char *newtop, *newbrk;
|
||||||
unsigned commitbytes, newbrksize;
|
unsigned commitbytes, newbrksize;
|
||||||
|
|
||||||
|
|
|
@ -273,7 +273,7 @@ public:
|
||||||
calloced = 1;
|
calloced = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void *dup_maybe (int i)
|
void dup_maybe (int i)
|
||||||
{
|
{
|
||||||
if (i >= calloced)
|
if (i >= calloced)
|
||||||
argv[i] = cstrdup (argv[i]);
|
argv[i] = cstrdup (argv[i]);
|
||||||
|
|
|
@ -194,24 +194,34 @@ setsid (void)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
extern "C" int
|
||||||
read_handler (int fd, void *ptr, size_t len)
|
_read (int fd, void *ptr, size_t len)
|
||||||
{
|
{
|
||||||
int res;
|
|
||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
fhandler_base *fh = fdtab[fd];
|
|
||||||
|
|
||||||
if (fdtab.not_open (fd))
|
if (fdtab.not_open (fd))
|
||||||
{
|
{
|
||||||
set_errno (EBADF);
|
set_errno (EBADF);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fh->get_flags() & (O_NONBLOCK | O_NDELAY)) && !fh->ready_for_read (fd, 0, 0))
|
set_sig_errno (0);
|
||||||
|
fhandler_base *fh = fdtab[fd];
|
||||||
|
DWORD wait = fh->get_flags () & (O_NONBLOCK | O_NDELAY) ? 0 : INFINITE;
|
||||||
|
|
||||||
|
/* Could block, so let user know we at least got here. */
|
||||||
|
syscall_printf ("read (%d, %p, %d)", fd, ptr, len);
|
||||||
|
|
||||||
|
int res;
|
||||||
|
if (wait && (!fh->is_slow () || fh->get_r_no_interrupt ()))
|
||||||
|
debug_printf ("non-interruptible read\n");
|
||||||
|
else if (!fh->ready_for_read (fd, wait, 0))
|
||||||
{
|
{
|
||||||
syscall_printf ("nothing to read");
|
if (!wait)
|
||||||
set_errno (EAGAIN);
|
set_sig_errno (EAGAIN);
|
||||||
return -1;
|
else
|
||||||
|
set_sig_errno (EINTR);
|
||||||
|
res = -1;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check to see if this is a background read from a "tty",
|
/* Check to see if this is a background read from a "tty",
|
||||||
|
@ -223,40 +233,13 @@ read_handler (int fd, void *ptr, size_t len)
|
||||||
res = fh->read (ptr, len);
|
res = fh->read (ptr, len);
|
||||||
myself->process_state &= ~PID_TTYIN;
|
myself->process_state &= ~PID_TTYIN;
|
||||||
}
|
}
|
||||||
syscall_printf ("%d = read (%d<%s>, %p, %d)", res, fd, fh->get_name (), ptr, len);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" int
|
|
||||||
_read (int fd, void *ptr, size_t len)
|
|
||||||
{
|
|
||||||
if (fdtab.not_open (fd))
|
|
||||||
{
|
|
||||||
set_errno (EBADF);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
set_sig_errno (0);
|
out:
|
||||||
fhandler_base *fh = fdtab[fd];
|
|
||||||
|
|
||||||
/* Could block, so let user know we at least got here. */
|
|
||||||
syscall_printf ("read (%d, %p, %d)", fd, ptr, len);
|
|
||||||
|
|
||||||
if (!fh->is_slow () || (fh->get_flags () & (O_NONBLOCK | O_NDELAY)) ||
|
|
||||||
fh->get_r_no_interrupt ())
|
|
||||||
{
|
|
||||||
debug_printf ("non-interruptible read\n");
|
|
||||||
return read_handler (fd, ptr, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fh->ready_for_read (fd, INFINITE, 0))
|
|
||||||
return read_handler (fd, ptr, len);
|
|
||||||
|
|
||||||
set_sig_errno (EINTR);
|
|
||||||
syscall_printf ("%d = read (%d<%s>, %p, %d), errno %d", -1, fd, fh->get_name (),
|
syscall_printf ("%d = read (%d<%s>, %p, %d), errno %d", -1, fd, fh->get_name (),
|
||||||
ptr, len, get_errno ());
|
ptr, len, get_errno ());
|
||||||
MALLOC_CHECK;
|
MALLOC_CHECK;
|
||||||
return -1;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
|
|
|
@ -151,9 +151,9 @@ HANDLE win32_obj_id;
|
||||||
UINT return_value;
|
UINT return_value;
|
||||||
bool used;
|
bool used;
|
||||||
char joinable; // for thread only
|
char joinable; // for thread only
|
||||||
bool HandleOke () {return win32_obj_id;};
|
bool HandleOke () {return win32_obj_id;}
|
||||||
virtual void Destroy ();
|
virtual void Destroy ();
|
||||||
virtual int Id () {return (int) win32_obj_id;};
|
virtual int Id () {return (int) win32_obj_id;}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ThreadItem:public MTitem
|
class ThreadItem:public MTitem
|
||||||
|
@ -165,7 +165,7 @@ void *arg;
|
||||||
void *return_ptr;
|
void *return_ptr;
|
||||||
bool suspended;
|
bool suspended;
|
||||||
DWORD thread_id;
|
DWORD thread_id;
|
||||||
DWORD GetThreadId () {return thread_id;};
|
DWORD GetThreadId () {return thread_id;}
|
||||||
|
|
||||||
/* signal handling */
|
/* signal handling */
|
||||||
struct sigaction *sigs;
|
struct sigaction *sigs;
|
||||||
|
|
Loading…
Reference in New Issue