Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-09-25 20:36:12 +0400
committerChristopher Faylor <me@cgf.cx>2000-09-25 20:36:12 +0400
commitfb5956da13ac60a3408632efd62e685458899924 (patch)
tree99cdd3b9367da6786298104991ee5750fc08b5e1 /winsup
parenteb69b80812d1b8e7d95b9e5abc95a0a839df13ed (diff)
* 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'.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog16
-rw-r--r--winsup/cygwin/environ.cc12
-rw-r--r--winsup/cygwin/heap.cc1
-rw-r--r--winsup/cygwin/spawn.cc2
-rw-r--r--winsup/cygwin/syscalls.cc59
-rw-r--r--winsup/cygwin/thread.h6
6 files changed, 50 insertions, 46 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index da7c80af5..f051c2c3b 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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>
* 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
* smallprint.c: ditto
* Makefile.in: don't __INSIDE_CYGWIN__ as it messes up profiling.
-
+
Wed Aug 2 11:22:53 2000 Christopher Faylor <cgf@cygnus.com>
* 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/crlf.c: non-verbose by default
-
+
* winsup.h: prune out windows headers we don't normally need
* assert.cc: add wingdi.h and winuser.h
* 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
* syscalls.cc: add winnls.h
* uinfo.cc: ditto
-
+
Thu Jul 27 10:24:36 2000 Egor Duda <deo@logos-m.ru>
* fhandler.cc (fhandler_disk_file::fstat): Allow block calculation to
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 9c7b72ce0..f0a3fc7d7 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -524,6 +524,7 @@ environ_init (char **envp)
char *p;
char *newp;
int sawTERM = 0;
+ bool envp_passed_in;
static char cygterm[] = "TERM=cygwin";
regopt ("default");
@@ -536,13 +537,16 @@ environ_init (char **envp)
allow_ntsec = TRUE;
#endif
- if (envp)
+ if (!envp)
+ envp_passed_in = 0;
+ else
{
sz = envsize (envp, 1);
char **newenv = (char **) malloc (sz);
memcpy (newenv, envp, sz);
cfree (envp);
envp = newenv;
+ envp_passed_in = 1;
goto out;
}
@@ -585,6 +589,12 @@ environ_init (char **envp)
out:
__cygwin_environ = envp;
update_envptrs ();
+ if (envp_passed_in)
+ {
+ p = getenv ("CYGWIN");
+ if (p)
+ parse_options (p);
+ }
parse_options (NULL);
MALLOC_CHECK;
}
diff --git a/winsup/cygwin/heap.cc b/winsup/cygwin/heap.cc
index dc2e6e977..f31848acd 100644
--- a/winsup/cygwin/heap.cc
+++ b/winsup/cygwin/heap.cc
@@ -86,6 +86,7 @@ heap_init ()
extern "C" void *
_sbrk(int n)
{
+ sigframe thisframe (mainthread);
char *newtop, *newbrk;
unsigned commitbytes, newbrksize;
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 3b46f6782..032082cf3 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -273,7 +273,7 @@ public:
calloced = 1;
}
}
- void *dup_maybe (int i)
+ void dup_maybe (int i)
{
if (i >= calloced)
argv[i] = cstrdup (argv[i]);
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 40dd69429..cb8683de8 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -194,24 +194,34 @@ setsid (void)
return -1;
}
-static int
-read_handler (int fd, void *ptr, size_t len)
+extern "C" int
+_read (int fd, void *ptr, size_t len)
{
- int res;
sigframe thisframe (mainthread);
- fhandler_base *fh = fdtab[fd];
-
if (fdtab.not_open (fd))
{
set_errno (EBADF);
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");
- set_errno (EAGAIN);
- return -1;
+ if (!wait)
+ set_sig_errno (EAGAIN);
+ else
+ set_sig_errno (EINTR);
+ res = -1;
+ goto out;
}
/* 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);
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);
- 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);
+out:
syscall_printf ("%d = read (%d<%s>, %p, %d), errno %d", -1, fd, fh->get_name (),
ptr, len, get_errno ());
MALLOC_CHECK;
- return -1;
+ return res;
}
extern "C"
diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h
index 4b265fbd1..b285faa4f 100644
--- a/winsup/cygwin/thread.h
+++ b/winsup/cygwin/thread.h
@@ -151,9 +151,9 @@ HANDLE win32_obj_id;
UINT return_value;
bool used;
char joinable; // for thread only
-bool HandleOke () {return win32_obj_id;};
+bool HandleOke () {return win32_obj_id;}
virtual void Destroy ();
-virtual int Id () {return (int) win32_obj_id;};
+virtual int Id () {return (int) win32_obj_id;}
};
class ThreadItem:public MTitem
@@ -165,7 +165,7 @@ void *arg;
void *return_ptr;
bool suspended;
DWORD thread_id;
-DWORD GetThreadId () {return thread_id;};
+DWORD GetThreadId () {return thread_id;}
/* signal handling */
struct sigaction *sigs;