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
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-09-07 20:23:51 +0400
committerChristopher Faylor <me@cgf.cx>2000-09-07 20:23:51 +0400
commit29ac7f89e36e5f5b46286cdbb5501bcea3ce2055 (patch)
tree53317078f39b909b63757eadca3cf80fdd654738 /winsup/cygwin/shared_info.h
parentc1644acb233ed749b28b4139604ab134cf1cd34c (diff)
Split out tty and shared_info stuff into their own headers and use throughout.
Include sys/termios.h for files which need it. * tty.h: New file. * shared_info.h: New file. * fhandler.h: Move inline methods that rely on tty stuff to fhandler_console.cc. * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Set output_done_event immediately after reading data to speed up tty output processing. (process_output): Set write_error to errno or zero. (fhandler_tty_slave::write): Check previous write error prior to writing to slave end of pipe. This allows tty output to be slightly less synchronous. * fhandler_console.cc (fhandler_console::tcsetpgrp): Moved here from fhandler.h. (fhandler_console::set_input_state): Ditto.
Diffstat (limited to 'winsup/cygwin/shared_info.h')
-rw-r--r--winsup/cygwin/shared_info.h130
1 files changed, 130 insertions, 0 deletions
diff --git a/winsup/cygwin/shared_info.h b/winsup/cygwin/shared_info.h
new file mode 100644
index 000000000..52c055989
--- /dev/null
+++ b/winsup/cygwin/shared_info.h
@@ -0,0 +1,130 @@
+/* shared_sec.h: shared info for cygwin
+
+ Copyright 1998, 1999, 2000 Cygnus Solutions.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+/* Mount table entry */
+
+class mount_item
+{
+public:
+ /* FIXME: Nasty static allocation. Need to have a heap in the shared
+ area [with the user being able to configure at runtime the max size]. */
+
+ /* Win32-style mounted partition source ("C:\foo\bar").
+ native_path[0] == 0 for unused entries. */
+ char native_path[MAX_PATH];
+ int native_pathlen;
+
+ /* POSIX-style mount point ("/foo/bar") */
+ char posix_path[MAX_PATH];
+ int posix_pathlen;
+
+ unsigned flags;
+
+ void init (const char *dev, const char *path, unsigned flags);
+
+ struct mntent *getmntent ();
+};
+
+/* Warning: Decreasing this value will cause cygwin.dll to ignore existing
+ higher numbered registry entries. Don't change this number willy-nilly.
+ What we need is to have a more dynamic allocation scheme, but the current
+ scheme should be satisfactory for a long while yet. */
+#define MAX_MOUNTS 30
+
+class mount_info
+{
+ int posix_sorted[MAX_MOUNTS];
+ int native_sorted[MAX_MOUNTS];
+public:
+ int nmounts;
+ mount_item mount[MAX_MOUNTS];
+
+ /* Strings used by getmntent(). */
+ char mnt_type[20];
+ char mnt_opts[20];
+ char mnt_fsname[MAX_PATH];
+ char mnt_dir[MAX_PATH];
+
+ /* cygdrive_prefix is used as the root of the path automatically
+ prepended to a path when the path has no associated mount.
+ cygdrive_flags are the default flags for the cygdrives. */
+ char cygdrive[MAX_PATH];
+ size_t cygdrive_len;
+ unsigned cygdrive_flags;
+
+ /* Increment when setting up a reg_key if mounts area had to be
+ created so we know when we need to import old mount tables. */
+ int had_to_create_mount_areas;
+
+ void init ();
+ int add_item (const char *dev, const char *path, unsigned flags, int reg_p);
+ int del_item (const char *path, unsigned flags, int reg_p);
+
+ void from_registry ();
+ int add_reg_mount (const char * native_path, const char * posix_path,
+ unsigned mountflags);
+ int del_reg_mount (const char * posix_path, unsigned mountflags);
+
+ unsigned set_flags_from_win32_path (const char *path);
+ int conv_to_win32_path (const char *src_path, char *win32_path,
+ char *full_win32_path, DWORD &devn, int &unit,
+ unsigned *flags = NULL);
+ int conv_to_posix_path (const char *src_path, char *posix_path,
+ int keep_rel_p);
+ struct mntent *getmntent (int x);
+
+ int write_cygdrive_info_to_registry (const char *cygdrive_prefix, unsigned flags);
+ int remove_cygdrive_info_from_registry (const char *cygdrive_prefix, unsigned flags);
+ int get_cygdrive_prefixes (char *user, char *system);
+
+ void import_v1_mounts ();
+
+private:
+
+ void sort ();
+ void read_mounts (reg_key& r);
+ void read_v1_mounts (reg_key r, unsigned which);
+ void mount_slash ();
+ void to_registry ();
+
+ int cygdrive_win32_path (const char *src, char *dst, int trailing_slash_p);
+ void cygdrive_posix_path (const char *src, char *dst, int trailing_slash_p);
+ void slash_drive_to_win32_path (const char *path, char *buf, int trailing_slash_p);
+ void read_cygdrive_info_from_registry ();
+};
+
+/******** Shared Info ********/
+/* Data accessible to all tasks */
+
+class shared_info
+{
+ DWORD inited;
+
+public:
+ /* FIXME: Doesn't work if more than one user on system. */
+ mount_info mount;
+
+ int heap_chunk_in_mb;
+ unsigned heap_chunk_size (void);
+
+ tty_list tty;
+ delqueue_list delqueue;
+ void initialize (void);
+};
+
+extern shared_info *cygwin_shared;
+extern HANDLE cygwin_shared_h;
+extern HANDLE console_shared_h;
+
+void __stdcall shared_init (void);
+void __stdcall shared_terminate (void);
+
+char *__stdcall shared_name (const char *, int);
+void *__stdcall open_shared (const char *name, HANDLE &shared_h, DWORD size, void *addr);