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.
This commit is contained in:
parent
b04b2e6b6d
commit
f62412f235
|
@ -1,3 +1,25 @@
|
||||||
|
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>
|
2006-07-14 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* fork.cc (fork): Lock the process before forking to prevent things
|
* fork.cc (fork): Lock the process before forking to prevent things
|
||||||
|
|
|
@ -216,7 +216,7 @@ public:
|
||||||
return strcpy (buf, name ());
|
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)));
|
__attribute__ ((regparm (3)));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1118,6 +1118,8 @@ int __stdcall
|
||||||
sigpacket::process ()
|
sigpacket::process ()
|
||||||
{
|
{
|
||||||
DWORD continue_now;
|
DWORD continue_now;
|
||||||
|
struct sigaction dummy = global_sigs[SIGSTOP];
|
||||||
|
|
||||||
if (si.si_signo != SIGCONT)
|
if (si.si_signo != SIGCONT)
|
||||||
continue_now = false;
|
continue_now = false;
|
||||||
else
|
else
|
||||||
|
@ -1235,7 +1237,6 @@ stop:
|
||||||
if (ISSTATE (myself, PID_STOPPED))
|
if (ISSTATE (myself, PID_STOPPED))
|
||||||
goto done;
|
goto done;
|
||||||
handler = (void *) sig_handle_tty_stop;
|
handler = (void *) sig_handle_tty_stop;
|
||||||
struct sigaction dummy = global_sigs[SIGSTOP];
|
|
||||||
thissig = dummy;
|
thissig = dummy;
|
||||||
|
|
||||||
dosig:
|
dosig:
|
||||||
|
|
|
@ -275,7 +275,7 @@ class fhandler_base
|
||||||
__attribute__ ((regparm (3)));
|
__attribute__ ((regparm (3)));
|
||||||
int __stdcall fstat_by_handle (struct __stat64 *buf) __attribute__ ((regparm (2)));
|
int __stdcall fstat_by_handle (struct __stat64 *buf) __attribute__ ((regparm (2)));
|
||||||
int __stdcall fstat_by_name (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 fchmod (mode_t mode) __attribute__ ((regparm (1)));
|
||||||
virtual int __stdcall fchown (__uid32_t uid, __gid32_t gid) __attribute__ ((regparm (2)));
|
virtual int __stdcall fchown (__uid32_t uid, __gid32_t gid) __attribute__ ((regparm (2)));
|
||||||
virtual int __stdcall facl (int, int, __acl32 *) __attribute__ ((regparm (3)));
|
virtual int __stdcall facl (int, int, __acl32 *) __attribute__ ((regparm (3)));
|
||||||
|
@ -601,7 +601,7 @@ class fhandler_dev_floppy: public fhandler_dev_raw
|
||||||
IMPLEMENT_STATUS_FLAG (bool, eom_detected)
|
IMPLEMENT_STATUS_FLAG (bool, eom_detected)
|
||||||
|
|
||||||
inline _off64_t get_current_position ();
|
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 write_file (const void *buf, DWORD to_write, DWORD *written, int *err);
|
||||||
BOOL read_file (void *buf, DWORD to_read, DWORD *read, int *err);
|
BOOL read_file (void *buf, DWORD to_read, DWORD *read, int *err);
|
||||||
|
@ -928,7 +928,7 @@ class fhandler_console: public fhandler_termios
|
||||||
static tty_min *get_tty_stuff (int);
|
static tty_min *get_tty_stuff (int);
|
||||||
bool is_slow () {return 1;}
|
bool is_slow () {return 1;}
|
||||||
static bool need_invisible ();
|
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
|
class fhandler_tty_common: public fhandler_termios
|
||||||
|
|
|
@ -150,6 +150,7 @@ fhandler_fifo::open (int flags, mode_t)
|
||||||
char mutex[CYG_MAX_PATH];
|
char mutex[CYG_MAX_PATH];
|
||||||
char *emutex = mutex + CYG_MAX_PATH;
|
char *emutex = mutex + CYG_MAX_PATH;
|
||||||
char *p, *p1;
|
char *p, *p1;
|
||||||
|
DWORD resw;
|
||||||
|
|
||||||
/* Generate a semi-unique name to associate with this fifo but try to ensure
|
/* Generate a semi-unique name to associate with this fifo but try to ensure
|
||||||
that it is no larger than CYG_MAX_PATH */
|
that it is no larger than CYG_MAX_PATH */
|
||||||
|
@ -175,7 +176,7 @@ fhandler_fifo::open (int flags, mode_t)
|
||||||
open an fd. */
|
open an fd. */
|
||||||
/* FIXME? Need to wait for signal here?
|
/* FIXME? Need to wait for signal here?
|
||||||
This shouldn't block for long, but... */
|
This shouldn't block for long, but... */
|
||||||
DWORD resw = WaitForSingleObject (h, INFINITE);
|
resw = WaitForSingleObject (h, INFINITE);
|
||||||
lock_process::locker.acquire (); /* Restore the lock */
|
lock_process::locker.acquire (); /* Restore the lock */
|
||||||
if (resw != WAIT_OBJECT_0 && resw != WAIT_ABANDONED_0)
|
if (resw != WAIT_OBJECT_0 && resw != WAIT_ABANDONED_0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -506,8 +506,7 @@ fhandler_dev_floppy::ioctl (unsigned int cmd, void *buf)
|
||||||
/* Just check the restriction that blocksize must be a multiple
|
/* Just check the restriction that blocksize must be a multiple
|
||||||
of the sector size of the underlying volume sector size,
|
of the sector size of the underlying volume sector size,
|
||||||
then fall through to fhandler_dev_raw::ioctl. */
|
then fall through to fhandler_dev_raw::ioctl. */
|
||||||
struct rdop *op = (struct rdop *) buf;
|
if (((struct rdop *) buf)->rd_parm % bytes_per_sector)
|
||||||
if (op->rd_parm % bytes_per_sector)
|
|
||||||
{
|
{
|
||||||
SetLastError (ERROR_INVALID_PARAMETER);
|
SetLastError (ERROR_INVALID_PARAMETER);
|
||||||
__seterrno ();
|
__seterrno ();
|
||||||
|
|
|
@ -1021,6 +1021,7 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg)
|
||||||
|
|
||||||
get_ttyp ()->cmd = cmd;
|
get_ttyp ()->cmd = cmd;
|
||||||
get_ttyp ()->ioctl_retval = 0;
|
get_ttyp ()->ioctl_retval = 0;
|
||||||
|
int val;
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case TIOCGWINSZ:
|
case TIOCGWINSZ:
|
||||||
|
@ -1052,7 +1053,7 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TIOCLINUX:
|
case TIOCLINUX:
|
||||||
int val = *(unsigned char *) arg;
|
val = *(unsigned char *) arg;
|
||||||
if (val != 6 || !ioctl_request_event || !ioctl_done_event)
|
if (val != 6 || !ioctl_request_event || !ioctl_done_event)
|
||||||
get_ttyp ()->ioctl_retval = -EINVAL;
|
get_ttyp ()->ioctl_retval = -EINVAL;
|
||||||
else
|
else
|
||||||
|
|
|
@ -977,6 +977,7 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off)
|
||||||
caddr_t base = NULL;
|
caddr_t base = NULL;
|
||||||
|
|
||||||
DWORD pagesize = getpagesize ();
|
DWORD pagesize = getpagesize ();
|
||||||
|
DWORD checkpagesize;
|
||||||
|
|
||||||
fh_anonymous.set_io_handle (INVALID_HANDLE_VALUE);
|
fh_anonymous.set_io_handle (INVALID_HANDLE_VALUE);
|
||||||
fh_anonymous.set_access (GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE);
|
fh_anonymous.set_access (GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE);
|
||||||
|
@ -1006,7 +1007,7 @@ 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,
|
at least most of the time is, allow 4K aligned addresses in 98,
|
||||||
to enable remapping of formerly mapped pages. If no matching
|
to enable remapping of formerly mapped pages. If no matching
|
||||||
free pages exist, check addr again, this time for the real alignment. */
|
free pages exist, check addr again, this time for the real alignment. */
|
||||||
DWORD checkpagesize = wincap.has_mmap_alignment_bug () ?
|
checkpagesize = wincap.has_mmap_alignment_bug () ?
|
||||||
getsystempagesize () : pagesize;
|
getsystempagesize () : pagesize;
|
||||||
if (fixed (flags) && ((uintptr_t) addr % checkpagesize))
|
if (fixed (flags) && ((uintptr_t) addr % checkpagesize))
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,6 +46,7 @@ fhandler_pipe::open (int flags, mode_t mode)
|
||||||
fhandler_pipe *fh = NULL;
|
fhandler_pipe *fh = NULL;
|
||||||
size_t size;
|
size_t size;
|
||||||
int pid, rwflags = (flags & O_ACCMODE);
|
int pid, rwflags = (flags & O_ACCMODE);
|
||||||
|
bool inh;
|
||||||
|
|
||||||
sscanf (get_name (), "/proc/%d/fd/pipe:[%d]", &pid, (int *) &pipe_hdl);
|
sscanf (get_name (), "/proc/%d/fd/pipe:[%d]", &pid, (int *) &pipe_hdl);
|
||||||
if (pid == myself->pid)
|
if (pid == myself->pid)
|
||||||
|
@ -93,7 +94,7 @@ fhandler_pipe::open (int flags, mode_t mode)
|
||||||
set_errno (EACCES);
|
set_errno (EACCES);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
bool inh = !(flags & O_NOINHERIT);
|
inh = !(flags & O_NOINHERIT);
|
||||||
if (!DuplicateHandle (proc, pipe_hdl, hMainProc, &nio_hdl,
|
if (!DuplicateHandle (proc, pipe_hdl, hMainProc, &nio_hdl,
|
||||||
0, inh, DUPLICATE_SAME_ACCESS))
|
0, inh, DUPLICATE_SAME_ACCESS))
|
||||||
{
|
{
|
||||||
|
|
|
@ -443,19 +443,17 @@ set_cygwin_privileges (HANDLE token)
|
||||||
set_privilege (token, SE_CHANGE_NOTIFY_PRIV, !allow_traverse);
|
set_privilege (token, SE_CHANGE_NOTIFY_PRIV, !allow_traverse);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Function to return a common SECURITY_DESCRIPTOR that
|
||||||
* Function to return a common SECURITY_DESCRIPTOR * that
|
allows all access. */
|
||||||
* allows all access.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static NO_COPY SECURITY_DESCRIPTOR *null_sdp = 0;
|
|
||||||
|
|
||||||
SECURITY_DESCRIPTOR *__stdcall
|
SECURITY_DESCRIPTOR *__stdcall
|
||||||
get_null_sd ()
|
get_null_sd ()
|
||||||
{
|
{
|
||||||
static NO_COPY SECURITY_DESCRIPTOR 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);
|
InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION);
|
||||||
SetSecurityDescriptorDacl (&sd, TRUE, 0, FALSE);
|
SetSecurityDescriptorDacl (&sd, TRUE, 0, FALSE);
|
||||||
|
@ -464,11 +462,8 @@ get_null_sd ()
|
||||||
return null_sdp;
|
return null_sdp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Initialize global security attributes.
|
||||||
* Initialize global security attributes.
|
Called from dcrt0.cc (_dll_crt0). */
|
||||||
*
|
|
||||||
* Called from dcrt0.cc (_dll_crt0).
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
void
|
||||||
init_global_security ()
|
init_global_security ()
|
||||||
|
|
|
@ -304,6 +304,11 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
||||||
path_conv real_path;
|
path_conv real_path;
|
||||||
bool reset_sendsig = false;
|
bool reset_sendsig = false;
|
||||||
|
|
||||||
|
const char *runpath;
|
||||||
|
int c_flags;
|
||||||
|
bool wascygexec;
|
||||||
|
cygheap_exec_info *moreinfo;
|
||||||
|
|
||||||
bool null_app_name = false;
|
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};
|
STARTUPINFO si = {0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL};
|
||||||
int looped = 0;
|
int looped = 0;
|
||||||
|
@ -326,7 +331,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
||||||
else
|
else
|
||||||
chtype = PROC_EXEC;
|
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;
|
moreinfo->old_title = NULL;
|
||||||
|
|
||||||
/* CreateProcess takes one long string that is the command line (sigh).
|
/* 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;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wascygexec = real_path.iscygexec ();
|
|
||||||
|
wascygexec = real_path.iscygexec ();
|
||||||
res = newargv.fixup (prog_arg, real_path, ext);
|
res = newargv.fixup (prog_arg, real_path, ext);
|
||||||
|
|
||||||
if (res)
|
if (res)
|
||||||
|
@ -410,7 +416,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
|
||||||
si.wShowWindow = SW_HIDE;
|
si.wShowWindow = SW_HIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int c_flags = GetPriorityClass (hMainProc);
|
c_flags = GetPriorityClass (hMainProc);
|
||||||
sigproc_printf ("priority class %d", c_flags);
|
sigproc_printf ("priority class %d", c_flags);
|
||||||
c_flags |= CREATE_SEPARATE_WOW_VDM;
|
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 ()))
|
|| cygheap->fdtab.need_fixup_before ()))
|
||||||
c_flags |= CREATE_SUSPENDED;
|
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);
|
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 *pgm = NULL;
|
||||||
char *arg1 = NULL;
|
char *arg1 = NULL;
|
||||||
|
char *ptr, *buf;
|
||||||
|
|
||||||
HANDLE h = CreateFile (real_path, GENERIC_READ,
|
HANDLE h = CreateFile (real_path, GENERIC_READ,
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
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;
|
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);
|
CloseHandle (hm);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
goto err;
|
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);
|
debug_printf ("%s is possibly a script", (char *) real_path);
|
||||||
|
|
||||||
char *ptr = buf;
|
ptr = buf;
|
||||||
if (*ptr++ == '#' && *ptr++ == '!')
|
if (*ptr++ == '#' && *ptr++ == '!')
|
||||||
{
|
{
|
||||||
ptr += strspn (ptr, " \t");
|
ptr += strspn (ptr, " \t");
|
||||||
|
|
|
@ -15,7 +15,7 @@ class wininfo
|
||||||
static muto _lock;
|
static muto _lock;
|
||||||
public:
|
public:
|
||||||
operator HWND ();
|
operator HWND ();
|
||||||
int __stdcall wininfo::process (HWND, UINT, WPARAM, LPARAM)
|
int __stdcall process (HWND, UINT, WPARAM, LPARAM)
|
||||||
__attribute__ ((regparm (3)));
|
__attribute__ ((regparm (3)));
|
||||||
void lock ();
|
void lock ();
|
||||||
void release ();
|
void release ();
|
||||||
|
|
Loading…
Reference in New Issue