diff options
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 38 | ||||
-rw-r--r-- | winsup/cygwin/cygheap.h | 2 | ||||
-rw-r--r-- | winsup/cygwin/cygwin.sc | 1 | ||||
-rwxr-xr-x | winsup/cygwin/dllfixdbg | 4 | ||||
-rw-r--r-- | winsup/cygwin/exceptions.cc | 3 | ||||
-rw-r--r-- | winsup/cygwin/fhandler.h | 6 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_fifo.cc | 3 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_floppy.cc | 3 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_tty.cc | 3 | ||||
-rw-r--r-- | winsup/cygwin/fork.cc | 6 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/types.h | 2 | ||||
-rw-r--r-- | winsup/cygwin/mmap.cc | 5 | ||||
-rw-r--r-- | winsup/cygwin/pipe.cc | 3 | ||||
-rw-r--r-- | winsup/cygwin/sec_helper.cc | 17 | ||||
-rw-r--r-- | winsup/cygwin/spawn.cc | 19 | ||||
-rw-r--r-- | winsup/cygwin/sync.h | 1 | ||||
-rw-r--r-- | winsup/cygwin/wininfo.h | 2 |
17 files changed, 85 insertions, 33 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 86400b6..368f7a1 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,41 @@ +2006-07-17 Christopher Faylor <cgf@timesys.com> + + GCC 4.1 fixes. + * cygheap.h (cygheap_user): Remove unneeded class names from function + declaration. + * fhandler.h (fhandler_base): Ditto. + (fhandler_dev_floppy): Ditto. + (fhandler_console): Ditto. + * wininfo.h (wininfo): Ditto. + * exceptions.cc (sigpacket::process): Avoid compiler errors about gotos + and initialization. + * fhandler_fifo.cc (fhandler_fifo::open): Ditto. + * fhandler_floppy.cc (fhandler_dev_floppy::ioctl): Ditto. + * fhandler_tty.cc (fhandler_tty_slave::ioctl): Ditto. + * mmap.cc (mmap64): Ditto. + * pipe.cc (fhandler_pipe::open): Ditto. + * spawn.cc (spawn_guts): Ditto. + + * sec_helper.cc: Fix some comments. + (get_null_sd): Move file-scope static to only function where it is + used. + +2006-07-14 Christopher Faylor <cgf@timesys.com> + + * fork.cc (fork): Lock the process before forking to prevent things + like new fds from being opened, etc. + * sync.h (lock_process::dont_bother): New function. + +2006-07-14 Christopher Faylor <cgf@timesys.com> + + * include/cygwin/types.h: Update copyright. + +2006-07-14 Christopher Faylor <cgf@timesys.com> + + * cygwin.sc: Make sure there's something in the cygheap. + * dllfixdbg: Accommodate newer binutils which put the gnu_debuglink at + the end rather than at the beginning. + 2006-07-14 Corinna Vinschen <corinna@vinschen.de> * security.cc (get_token_group_sidlist): Always add the interactive diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h index cb18d3d..0afe162 100644 --- a/winsup/cygwin/cygheap.h +++ b/winsup/cygwin/cygheap.h @@ -216,7 +216,7 @@ public: return strcpy (buf, name ()); } - const char *cygheap_user::test_uid (char *&, const char *, size_t) + const char *test_uid (char *&, const char *, size_t) __attribute__ ((regparm (3))); }; diff --git a/winsup/cygwin/cygwin.sc b/winsup/cygwin/cygwin.sc index cc2b9e6..58ee376 100644 --- a/winsup/cygwin/cygwin.sc +++ b/winsup/cygwin/cygwin.sc @@ -106,6 +106,7 @@ SECTIONS { __cygheap_mid = .; *(.cygheap) + . = . + 1; . = ALIGN(512 * 1024); } __cygheap_end = ABSOLUTE(.); diff --git a/winsup/cygwin/dllfixdbg b/winsup/cygwin/dllfixdbg index 909d113..4ffc4e6 100755 --- a/winsup/cygwin/dllfixdbg +++ b/winsup/cygwin/dllfixdbg @@ -24,9 +24,10 @@ while (<OBJDUMP>) { my ($idx, $name, $size, $vma, $lma, $fileoff, $algn) = /^\s*(\d+)\s+(\.\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*$/; if ($name eq '.gnu_debuglink') { push(@objcopy, '--set-section-flag', '.gnu_debuglink=contents,readonly,debug,noload'); + $idx = $section{'.gnu_debuglink'}{-idx} if defined($section{'.gnu_debuglink'}{-idx}); } elsif ($name eq '.gnu_debuglink_overlay') { push (@objcopy, '-R', '.gnu_debuglink_overlay'); - $section{'.gnu_debuglink'}{-idx} = $idx if $section{'.gnu_debuglink'}; + $section{'.gnu_debuglink'}{-idx} = $idx; next; } defined($idx) and @@ -53,6 +54,7 @@ for my $k (sort {$section{$a}{-idx} <=> $section{$b}{-idx}} keys %section) { } $vma = align($vma + $section{$k}{-size}, $section{$k}{-algn}); } + warn "$0: ERROR final VMA (" . sprintf("0x%08x", $vma) . ") not on 64K boundary\n" if $vma != align($vma, 64 * 1024); push(@objcopy, $dll, @ARGV); xit 1, @objcopy; diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 12c6e06..e5345f1 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -1118,6 +1118,8 @@ int __stdcall sigpacket::process () { DWORD continue_now; + struct sigaction dummy = global_sigs[SIGSTOP]; + if (si.si_signo != SIGCONT) continue_now = false; else @@ -1235,7 +1237,6 @@ stop: if (ISSTATE (myself, PID_STOPPED)) goto done; handler = (void *) sig_handle_tty_stop; - struct sigaction dummy = global_sigs[SIGSTOP]; thissig = dummy; dosig: diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 887b929..06ae26e 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -275,7 +275,7 @@ class fhandler_base __attribute__ ((regparm (3))); int __stdcall fstat_by_handle (struct __stat64 *buf) __attribute__ ((regparm (2))); int __stdcall fstat_by_name (struct __stat64 *buf) __attribute__ ((regparm (2))); - int fhandler_base::utimes_fs (const struct timeval *) __attribute__ ((regparm (2))); + int utimes_fs (const struct timeval *) __attribute__ ((regparm (2))); virtual int __stdcall fchmod (mode_t mode) __attribute__ ((regparm (1))); virtual int __stdcall fchown (__uid32_t uid, __gid32_t gid) __attribute__ ((regparm (2))); virtual int __stdcall facl (int, int, __acl32 *) __attribute__ ((regparm (3))); @@ -614,7 +614,7 @@ class fhandler_dev_floppy: public fhandler_dev_raw IMPLEMENT_STATUS_FLAG (bool, eom_detected) inline _off64_t get_current_position (); - int fhandler_dev_floppy::get_drive_info (struct hd_geometry *geo); + int get_drive_info (struct hd_geometry *geo); BOOL write_file (const void *buf, DWORD to_write, DWORD *written, int *err); BOOL read_file (void *buf, DWORD to_read, DWORD *read, int *err); @@ -941,7 +941,7 @@ class fhandler_console: public fhandler_termios static tty_min *get_tty_stuff (int); bool is_slow () {return 1;} static bool need_invisible (); - static bool fhandler_console::has_a () {return !invisible_console;} + static bool has_a () {return !invisible_console;} }; class fhandler_tty_common: public fhandler_termios diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc index 8f1a584..aa63152 100644 --- a/winsup/cygwin/fhandler_fifo.cc +++ b/winsup/cygwin/fhandler_fifo.cc @@ -150,6 +150,7 @@ fhandler_fifo::open (int flags, mode_t) char mutex[CYG_MAX_PATH]; char *emutex = mutex + CYG_MAX_PATH; char *p, *p1; + DWORD resw; /* Generate a semi-unique name to associate with this fifo but try to ensure that it is no larger than CYG_MAX_PATH */ @@ -175,7 +176,7 @@ fhandler_fifo::open (int flags, mode_t) open an fd. */ /* FIXME? Need to wait for signal here? This shouldn't block for long, but... */ - DWORD resw = WaitForSingleObject (h, INFINITE); + resw = WaitForSingleObject (h, INFINITE); lock_process::locker.acquire (); /* Restore the lock */ if (resw != WAIT_OBJECT_0 && resw != WAIT_ABANDONED_0) { diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc index 9667235..4595e73 100644 --- a/winsup/cygwin/fhandler_floppy.cc +++ b/winsup/cygwin/fhandler_floppy.cc @@ -506,8 +506,7 @@ fhandler_dev_floppy::ioctl (unsigned int cmd, void *buf) /* Just check the restriction that blocksize must be a multiple of the sector size of the underlying volume sector size, then fall through to fhandler_dev_raw::ioctl. */ - struct rdop *op = (struct rdop *) buf; - if (op->rd_parm % bytes_per_sector) + if (((struct rdop *) buf)->rd_parm % bytes_per_sector) { SetLastError (ERROR_INVALID_PARAMETER); __seterrno (); diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 9ecba14..0121d62 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -1021,6 +1021,7 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg) get_ttyp ()->cmd = cmd; get_ttyp ()->ioctl_retval = 0; + int val; switch (cmd) { case TIOCGWINSZ: @@ -1052,7 +1053,7 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg) } break; case TIOCLINUX: - int val = *(unsigned char *) arg; + val = *(unsigned char *) arg; if (val != 6 || !ioctl_request_event || !ioctl_done_event) get_ttyp ()->ioctl_retval = -EINVAL; else diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 2043629..ed85e74 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -533,6 +533,7 @@ fork () return -1; } + lock_process now; if (sig_send (NULL, __SIGHOLD)) { if (exit_state) @@ -547,7 +548,10 @@ fork () __asm__ volatile ("movl %%esp,%0": "=r" (esp)); if (ischild) - res = grouped.child (esp); + { + res = grouped.child (esp); + now.dont_bother (); + } else { res = grouped.parent (esp); diff --git a/winsup/cygwin/include/cygwin/types.h b/winsup/cygwin/include/cygwin/types.h index c37ab26..f924211 100644 --- a/winsup/cygwin/include/cygwin/types.h +++ b/winsup/cygwin/include/cygwin/types.h @@ -1,6 +1,6 @@ /* types.h - Copyright 2001, 2002, 2003 Red Hat Inc. + Copyright 2001, 2002, 2003, 2005 Red Hat Inc. Written by Robert Collins <rbtcollins@hotmail.com> This file is part of Cygwin. diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 85718ee..5ace55c 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -977,6 +977,7 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off) caddr_t base = NULL; DWORD pagesize = getpagesize (); + DWORD checkpagesize; fh_anonymous.set_io_handle (INVALID_HANDLE_VALUE); fh_anonymous.set_access (GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE); @@ -1006,8 +1007,8 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off) at least most of the time is, allow 4K aligned addresses in 98, to enable remapping of formerly mapped pages. If no matching free pages exist, check addr again, this time for the real alignment. */ - DWORD checkpagesize = wincap.has_mmap_alignment_bug () ? - getsystempagesize () : pagesize; + checkpagesize = wincap.has_mmap_alignment_bug () ? + getsystempagesize () : pagesize; if (fixed (flags) && ((uintptr_t) addr % checkpagesize)) { set_errno (EINVAL); diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc index 183bd18..a6171f2 100644 --- a/winsup/cygwin/pipe.cc +++ b/winsup/cygwin/pipe.cc @@ -46,6 +46,7 @@ fhandler_pipe::open (int flags, mode_t mode) fhandler_pipe *fh = NULL; size_t size; int pid, rwflags = (flags & O_ACCMODE); + bool inh; sscanf (get_name (), "/proc/%d/fd/pipe:[%d]", &pid, (int *) &pipe_hdl); if (pid == myself->pid) @@ -93,7 +94,7 @@ fhandler_pipe::open (int flags, mode_t mode) set_errno (EACCES); goto out; } - bool inh = !(flags & O_NOINHERIT); + inh = !(flags & O_NOINHERIT); if (!DuplicateHandle (proc, pipe_hdl, hMainProc, &nio_hdl, 0, inh, DUPLICATE_SAME_ACCESS)) { diff --git a/winsup/cygwin/sec_helper.cc b/winsup/cygwin/sec_helper.cc index d8cd160..a32dcb8 100644 --- a/winsup/cygwin/sec_helper.cc +++ b/winsup/cygwin/sec_helper.cc @@ -443,19 +443,17 @@ set_cygwin_privileges (HANDLE token) set_privilege (token, SE_CHANGE_NOTIFY_PRIV, !allow_traverse); } -/* - * Function to return a common SECURITY_DESCRIPTOR * that - * allows all access. - */ +/* Function to return a common SECURITY_DESCRIPTOR that + allows all access. */ -static NO_COPY SECURITY_DESCRIPTOR *null_sdp = 0; SECURITY_DESCRIPTOR *__stdcall get_null_sd () { static NO_COPY SECURITY_DESCRIPTOR sd; + static NO_COPY SECURITY_DESCRIPTOR *null_sdp; - if (null_sdp == 0) + if (!null_sdp) { InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION); SetSecurityDescriptorDacl (&sd, TRUE, 0, FALSE); @@ -464,11 +462,8 @@ get_null_sd () return null_sdp; } -/* - * Initialize global security attributes. - * - * Called from dcrt0.cc (_dll_crt0). - */ +/* Initialize global security attributes. + Called from dcrt0.cc (_dll_crt0). */ void init_global_security () diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 40a57c0..d1ee321 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -304,6 +304,11 @@ spawn_guts (const char * prog_arg, const char *const *argv, path_conv real_path; bool reset_sendsig = false; + const char *runpath; + int c_flags; + bool wascygexec; + cygheap_exec_info *moreinfo; + bool null_app_name = false; STARTUPINFO si = {0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL}; int looped = 0; @@ -326,7 +331,7 @@ spawn_guts (const char * prog_arg, const char *const *argv, else chtype = PROC_EXEC; - cygheap_exec_info *moreinfo = (cygheap_exec_info *) ccalloc (HEAP_1_EXEC, 1, sizeof (cygheap_exec_info)); + moreinfo = (cygheap_exec_info *) ccalloc (HEAP_1_EXEC, 1, sizeof (cygheap_exec_info)); moreinfo->old_title = NULL; /* CreateProcess takes one long string that is the command line (sigh). @@ -347,7 +352,8 @@ spawn_guts (const char * prog_arg, const char *const *argv, goto out; } - bool wascygexec = real_path.iscygexec (); + + wascygexec = real_path.iscygexec (); res = newargv.fixup (prog_arg, real_path, ext); if (res) @@ -410,7 +416,7 @@ spawn_guts (const char * prog_arg, const char *const *argv, si.wShowWindow = SW_HIDE; } - int c_flags = GetPriorityClass (hMainProc); + c_flags = GetPriorityClass (hMainProc); sigproc_printf ("priority class %d", c_flags); c_flags |= CREATE_SEPARATE_WOW_VDM; @@ -454,7 +460,7 @@ spawn_guts (const char * prog_arg, const char *const *argv, || cygheap->fdtab.need_fixup_before ())) c_flags |= CREATE_SUSPENDED; - const char *runpath = null_app_name ? NULL : (const char *) real_path; + runpath = null_app_name ? NULL : (const char *) real_path; syscall_printf ("null_app_name %d (%s, %.9500s)", null_app_name, runpath, one_line.buf); @@ -907,6 +913,7 @@ av::fixup (const char *prog_arg, path_conv& real_path, const char *ext) { char *pgm = NULL; char *arg1 = NULL; + char *ptr, *buf; HANDLE h = CreateFile (real_path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, @@ -927,7 +934,7 @@ av::fixup (const char *prog_arg, path_conv& real_path, const char *ext) } goto err; } - char *buf = (char *) MapViewOfFile(hm, FILE_MAP_READ, 0, 0, 0); + buf = (char *) MapViewOfFile(hm, FILE_MAP_READ, 0, 0, 0); CloseHandle (hm); if (!buf) goto err; @@ -957,7 +964,7 @@ av::fixup (const char *prog_arg, path_conv& real_path, const char *ext) debug_printf ("%s is possibly a script", (char *) real_path); - char *ptr = buf; + ptr = buf; if (*ptr++ == '#' && *ptr++ == '!') { ptr += strspn (ptr, " \t"); diff --git a/winsup/cygwin/sync.h b/winsup/cygwin/sync.h index 8fd01df..f7ce7e1 100644 --- a/winsup/cygwin/sync.h +++ b/winsup/cygwin/sync.h @@ -50,6 +50,7 @@ class lock_process static muto locker; public: static void init () {locker.init ("lock_process");} + void dont_bother () {skip_unlock = true;} lock_process (bool exiting = false) { locker.acquire (); diff --git a/winsup/cygwin/wininfo.h b/winsup/cygwin/wininfo.h index 0247ae9..f67cf9a 100644 --- a/winsup/cygwin/wininfo.h +++ b/winsup/cygwin/wininfo.h @@ -15,7 +15,7 @@ class wininfo static muto _lock; public: operator HWND (); - int __stdcall wininfo::process (HWND, UINT, WPARAM, LPARAM) + int __stdcall process (HWND, UINT, WPARAM, LPARAM) __attribute__ ((regparm (3))); void lock (); void release (); |