+2006-07-26 Corinna Vinschen <corinna@vinschen.de>
+
+ * cygheap.h (struct init_cygheap): Remove shared_h and mt_h members.
+ * fhandler_tape.cc (mt): Define as DLL shared area in
+ .cygwin_dll_common instead of as dynamically allocated area.
+ Change referencing throughout.
+ * mtinfo.h (mt_h): Remove entirely.
+ (mt): Remove extern declaration.
+ * shared.cc (cygwin_shared_area): New global cygwin_shared
+ variable located in .cygwin_dll_common.
+ (offsets): Define shared region addresses descending from
+ cygwin_shared_address.
+ (open_shared): Replace usage of SH_CYGWIN_SHARED by SH_USER_SHARED.
+ (memory_init): Set cygwin_shared just by pointing to cygwin_shared_area.
+ * shared_info.h (shared_locations): Remove SH_CYGWIN_SHARED and
+ SH_MTINFO.
+ (cygwin_shared_address): Define as DLL start address.
+ * tty.h (tty_min::tty_min): Remove constructor.
+
2006-07-25 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/in6.h: Guard in_port_t typedef more restrictive to
/* cygheap.h: Cygwin heap manager.
- Copyright 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Cygwin.
cygheap_user user;
user_heap_info user_heap;
mode_t umask;
- HANDLE shared_h;
HANDLE console_h;
- HANDLE mt_h;
cwdstuff cwd;
dtable fdtab;
LUID luid[SE_NUM_PRIVS];
/* fhandler_tape.cc. See fhandler.h for a description of the fhandler
classes.
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Cygwin.
}
}
-mtinfo *mt;
+static mtinfo mt __attribute__((section (".cygwin_dll_common"), shared));
void __stdcall
mtinfo_init ()
{
- shared_locations sh_mtinfo = SH_MTINFO;
- mt = (mtinfo *) open_shared ("mtinfo", MTINFO_VERSION, cygheap->mt_h, sizeof (mtinfo), sh_mtinfo);
- ProtectHandleINH (cygheap->mt_h);
- mt->initialize ();
+ mt.initialize ();
}
/**********************************************************************/
into O_SYNC, which controls the FILE_WRITE_THROUGH flag in the
NtCreateFile call in fhandler_base::open. */
flags &= ~O_SYNC;
- if (!mt->drive (driveno ())->buffer_writes ())
+ if (!mt.drive (driveno ())->buffer_writes ())
flags |= O_SYNC;
ret = fhandler_dev_raw::open (flags);
if (ret)
{
- mt->drive (driveno ())->open (get_handle ());
+ mt.drive (driveno ())->open (get_handle ());
/* In append mode, seek to beginning of next filemark */
if (flags & O_APPEND)
- mt->drive (driveno ())->set_pos (get_handle (),
+ mt.drive (driveno ())->set_pos (get_handle (),
TAPE_SPACE_FILEMARKS, 1, true);
if (!(flags & O_DIRECT))
{
- devbufsiz = mt->drive (driveno ())->dp ()->MaximumBlockSize;
+ devbufsiz = mt.drive (driveno ())->dp ()->MaximumBlockSize;
devbuf = new char [devbufsiz];
}
devbufstart = devbufend = 0;
if (!hExeced)
{
lock (-1);
- ret = mt->drive (driveno ())->close (get_handle (), is_rewind_device ());
+ ret = mt.drive (driveno ())->close (get_handle (), is_rewind_device ());
if (ret)
__seterrno_from_win_error (ret);
cret = fhandler_dev_raw::close ();
ulen = (size_t) -1;
return;
}
- block_size = mt->drive (driveno ())->mp ()->BlockSize;
+ block_size = mt.drive (driveno ())->mp ()->BlockSize;
if (devbuf)
{
if (devbufend > devbufstart)
{
debug_printf ("read %d bytes from tape (rest %d)",
block_fit, len - block_fit);
- ret = mt->drive (driveno ())->read (get_handle (), mt_evt, buf,
+ ret = mt.drive (driveno ())->read (get_handle (), mt_evt, buf,
block_fit);
if (ret)
__seterrno_from_win_error (ret);
if (!ret && len > 0)
{
debug_printf ("read %d bytes from tape (one block)", block_size);
- ret = mt->drive (driveno ())->read (get_handle (), mt_evt, devbuf,
+ ret = mt.drive (driveno ())->read (get_handle (), mt_evt, devbuf,
block_size);
if (ret)
__seterrno_from_win_error (ret);
if (!mt_evt && !(mt_evt = CreateEvent (&sec_none, TRUE, FALSE, NULL)))
debug_printf ("Creating event failed, %E");
bytes_read = ulen;
- ret = mt->drive (driveno ())->read (get_handle (), mt_evt, ptr,
+ ret = mt.drive (driveno ())->read (get_handle (), mt_evt, ptr,
bytes_read);
}
ulen = (ret ? (size_t) -1 : bytes_read);
lock (-1);
if (!mt_evt && !(mt_evt = CreateEvent (&sec_none, TRUE, FALSE, NULL)))
debug_printf ("Creating event failed, %E");
- int ret = mt->drive (driveno ())->write (get_handle (), mt_evt, ptr, len);
+ int ret = mt.drive (driveno ())->write (get_handle (), mt_evt, ptr, len);
if (ret)
__seterrno_from_win_error (ret);
return unlock (ret ? -1 : (int) len);
debug_printf ("lseek (%s, %d, %d)", get_name (), offset, whence);
- block_size = mt->drive (driveno ())->mp ()->BlockSize;
+ block_size = mt.drive (driveno ())->mp ()->BlockSize;
if (block_size == 0)
{
set_errno (EIO);
lock (-1);
if (cmd == MTIOCTOP || cmd == MTIOCGET || cmd == MTIOCPOS)
{
- ret = mt->drive (driveno ())->ioctl (get_handle (), cmd, buf);
+ ret = mt.drive (driveno ())->ioctl (get_handle (), cmd, buf);
if (ret)
__seterrno_from_win_error (ret);
return unlock (ret ? -1 : 0);
/* mtinfo.h: Defininitions for the Cygwin tape driver class.
- Copyright 2004 Red Hat, Inc.
+ Copyright 2004, 2005, 2006 Red Hat, Inc.
This file is part of Cygwin.
mtinfo_drive *drive (int num) { return &_drive[num]; }
};
-extern HANDLE mt_h;
-extern mtinfo *mt;
-
extern void __stdcall mtinfo_init ();
/* shared.cc: shared data area support.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2006 Red Hat, Inc.
This file is part of Cygwin.
#include "child_info.h"
#include "mtinfo.h"
+static shared_info cygwin_shared_area __attribute__((section (".cygwin_dll_common"), shared));
shared_info NO_COPY *cygwin_shared;
user_info NO_COPY *user_shared;
HANDLE NO_COPY cygwin_user_h;
static char *offsets[] =
{
- (char *) cygwin_shared_address,
(char *) cygwin_shared_address
- + pround (sizeof (shared_info)),
+ - pround (sizeof (user_info))
+ - pround (sizeof (console_state))
+ - pround (sizeof (_pinfo)),
(char *) cygwin_shared_address
- + pround (sizeof (shared_info))
- + pround (sizeof (user_info)),
+ - pround (sizeof (console_state))
+ - pround (sizeof (_pinfo)),
(char *) cygwin_shared_address
- + pround (sizeof (shared_info))
- + pround (sizeof (user_info))
- + pround (sizeof (console_state)),
+ - pround (sizeof (_pinfo)),
(char *) cygwin_shared_address
- + pround (sizeof (shared_info))
- + pround (sizeof (user_info))
- + pround (sizeof (console_state))
- + pround (sizeof (_pinfo)),
- (char *) cygwin_shared_address
- + pround (sizeof (shared_info))
- + pround (sizeof (user_info))
- + pround (sizeof (console_state))
- + pround (sizeof (_pinfo))
- + pround (sizeof (mtinfo))
};
void * __stdcall
if (!shared)
api_fatal ("MapViewOfFileEx '%s'(%p), %E. Terminating.", mapname, shared_h);
- if (m == SH_CYGWIN_SHARED && offsets[0] && wincap.needs_memory_protection ())
+ if (m == SH_USER_SHARED && offsets[0] && wincap.needs_memory_protection ())
{
unsigned delta = (char *) shared - offsets[0];
offsets[0] = (char *) shared;
- for (int i = SH_CYGWIN_SHARED + 1; i < SH_TOTAL_SIZE; i++)
+ for (int i = SH_USER_SHARED + 1; i < SH_TOTAL_SIZE; i++)
{
unsigned size = offsets[i + 1] - offsets[i];
offsets[i] += delta;
cygheap->user.init ();
}
- /* Initialize general shared memory */
- shared_locations sh_cygwin_shared = SH_CYGWIN_SHARED;
- cygwin_shared = (shared_info *) open_shared ("shared",
- CYGWIN_VERSION_SHARED_DATA,
- cygheap->shared_h,
- sizeof (*cygwin_shared),
- sh_cygwin_shared);
-
+ cygwin_shared = &cygwin_shared_area;
cygwin_shared->initialize ();
- ProtectHandleINH (cygheap->shared_h);
user_shared_initialize (false);
mtinfo_init ();
/* shared_info.h: shared info for cygwin
- Copyright 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Cygwin.
enum shared_locations
{
- SH_CYGWIN_SHARED,
SH_USER_SHARED,
SH_SHARED_CONSOLE,
SH_MYSELF,
- SH_MTINFO,
SH_TOTAL_SIZE,
SH_JUSTCREATE,
SH_JUSTOPEN
(((DWORD) ((p) + 1) + system_info.dwAllocationGranularity - 1) / \
system_info.dwAllocationGranularity)))
-#define cygwin_shared_address ((void *) 0x60000000)
+#define cygwin_shared_address ((void *) 0x61000000)
#ifdef _FHANDLER_H_
struct console_state
/* tty.h: shared tty info for cygwin
- Copyright 2000, 2001, 2002, 2003, 2004 Red Hat, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2006 Red Hat, Inc.
This file is part of Cygwin.
int ioctl_retval;
int write_error;
- tty_min (int t = -1, pid_t s = -1) : sid (s), ntty (t) {}
void setntty (int n) {ntty = n;}
pid_t getpgid () {return pgid;}
void setpgid (int pid) {pgid = pid;}