⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fhandler.h

📁 cygwin, 著名的在win32下模拟unix操作系统的东东
💻 H
📖 第 1 页 / 共 3 页
字号:
  int fcntl (int cmd, void *);  __off64_t lseek (__off64_t, int) { return 0; }  int shutdown (int how);  int close ();  void hclose (HANDLE) {close ();}  int dup (fhandler_base *child);  void set_close_on_exec (int val);  virtual void fixup_before_fork_exec (DWORD);  void fixup_after_fork (HANDLE);  void fixup_after_exec (HANDLE);  select_record *select_read (select_record *s);  select_record *select_write (select_record *s);  select_record *select_except (select_record *s);  void set_addr_family (int af) {addr_family = af;}  int get_addr_family () {return addr_family;}  void set_socket_type (int st) { type = st;}  int get_socket_type () {return type;}  void set_sun_path (const char *path);  char *get_sun_path () {return sun_path;}  void set_connect_secret ();  void get_connect_secret (char*);  HANDLE create_secret_event (int *secret = NULL);  int check_peer_secret_event (struct sockaddr_in *peer, int *secret = NULL);  void signal_secret_event ();  void close_secret_event ();  int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));};class fhandler_pipe: public fhandler_base{  HANDLE guard;  bool broken_pipe;  HANDLE writepipe_exists;  DWORD orig_pid;  unsigned id; public:  fhandler_pipe (DWORD devtype);  __off64_t lseek (__off64_t offset, int whence);  select_record *select_read (select_record *s);  select_record *select_write (select_record *s);  select_record *select_except (select_record *s);  void set_close_on_exec (int val);  int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));  int close ();  void create_guard (SECURITY_ATTRIBUTES *sa) {guard = CreateMutex (sa, FALSE, NULL);}  int dup (fhandler_base *child);  int ioctl (unsigned int cmd, void *);  void fixup_after_fork (HANDLE);  bool hit_eof ();  void set_eof () {broken_pipe = true;}  friend int make_pipe (int fildes[2], unsigned int psize, int mode);  HANDLE get_guard () const {return guard;}};class fhandler_dev_raw: public fhandler_base{ protected:  char *devbuf;  size_t devbufsiz;  size_t devbufstart;  size_t devbufend;  int eom_detected    : 1;  int eof_detected    : 1;  int lastblk_to_read : 1;  int is_writing      : 1;  int has_written     : 1;  int varblkop	      : 1;  int unit;  virtual void clear (void);  virtual int writebuf (void);  /* returns not null, if `win_error' determines an end of media condition */  virtual int is_eom(int win_error) = 0;  /* returns not null, if `win_error' determines an end of file condition */  virtual int is_eof(int win_error) = 0;  fhandler_dev_raw (DWORD dev, int unit); public:  ~fhandler_dev_raw (void);  int get_unit () { return unit; }  int open (path_conv *, int flags, mode_t mode = 0);  int close (void);  int raw_read (void *ptr, size_t ulen);  int raw_write (const void *ptr, size_t ulen);  int dup (fhandler_base *child);  int ioctl (unsigned int cmd, void *buf);  void fixup_after_fork (HANDLE);  void fixup_after_exec (HANDLE);};class fhandler_dev_floppy: public fhandler_dev_raw{ protected:  virtual int is_eom (int win_error);  virtual int is_eof (int win_error); public:  fhandler_dev_floppy (int unit);  virtual int open (path_conv *, int flags, mode_t mode = 0);  virtual int close (void);  virtual __off64_t lseek (__off64_t offset, int whence);  virtual int ioctl (unsigned int cmd, void *buf);};class fhandler_dev_tape: public fhandler_dev_raw{  int lasterr;  bool is_rewind_device () { return get_unit () < 128; } protected:  virtual void clear (void);  virtual int is_eom (int win_error);  virtual int is_eof (int win_error); public:  fhandler_dev_tape (int unit);  virtual int open (path_conv *, int flags, mode_t mode = 0);  virtual int close (void);  virtual __off64_t lseek (__off64_t offset, int whence);  virtual int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));  virtual int dup (fhandler_base *child);  virtual int ioctl (unsigned int cmd, void *buf); private:  int tape_write_marks (int marktype, DWORD len);  int tape_get_pos (unsigned long *ret);  int tape_set_pos (int mode, long count, BOOLEAN sfm_func = FALSE);  int tape_erase (int mode);  int tape_prepare (int action);  BOOLEAN tape_get_feature (DWORD parm);  int tape_get_blocksize (long *min, long *def, long *max, long *cur);  int tape_set_blocksize (long count);  int tape_status (struct mtget *get);  int tape_compression (long count);};/* Standard disk file */class fhandler_disk_file: public fhandler_base{ public:  fhandler_disk_file ();  fhandler_disk_file (DWORD devtype);  int open (path_conv * real_path, int flags, mode_t mode);  int close ();  int lock (int, struct flock *);  BOOL is_device () { return FALSE; }  int __stdcall fstat (struct __stat64 *buf, path_conv *pc) __attribute__ ((regparm (3)));  int __stdcall fstat_helper (struct __stat64 *buf, path_conv *pc,			      FILETIME ftCreateionTime,			      FILETIME ftLastAccessTime,			      FILETIME ftLastWriteTime,			      DWORD nFileSizeHigh,			      DWORD nFileSizeLow,			      DWORD nFileIndexHigh = 0,			      DWORD nFileIndexLow = 0,			      DWORD nNumberOfLinks = 1)    __attribute__ ((regparm (3)));  int __stdcall fstat_by_handle (struct __stat64 *buf, path_conv *pc) __attribute__ ((regparm (3)));  int __stdcall fstat_by_name (struct __stat64 *buf, path_conv *pc) __attribute__ ((regparm (3)));  HANDLE mmap (caddr_t *addr, size_t len, DWORD access, int flags, __off64_t off);  int munmap (HANDLE h, caddr_t addr, size_t len);  int msync (HANDLE h, caddr_t addr, size_t len, int flags);  BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset,			      DWORD size, void *address);  DIR *opendir (path_conv& pc);  struct dirent *readdir (DIR *);  __off64_t telldir (DIR *);  void seekdir (DIR *, __off64_t);  void rewinddir (DIR *);  int closedir (DIR *);};class fhandler_cygdrive: public fhandler_disk_file{  int unit;  int ndrives;  const char *pdrive;  void set_drives (); public:  bool iscygdrive_root () const { return !unit; }  fhandler_cygdrive (int unit);  DIR *opendir (path_conv& pc);  struct dirent *readdir (DIR *);  __off64_t telldir (DIR *);  void seekdir (DIR *, __off64_t);  void rewinddir (DIR *);  int closedir (DIR *);  int __stdcall fstat (struct __stat64 *buf, path_conv *pc) __attribute__ ((regparm (3)));};class fhandler_serial: public fhandler_base{ private:  size_t vmin_;				/* from termios */  unsigned int vtime_;			/* from termios */  pid_t pgrp_;  int rts;				/* for Windows 9x purposes only */  int dtr;				/* for Windows 9x purposes only */ public:  int overlapped_armed;  OVERLAPPED io_status;  DWORD ev;  /* Constructor */  fhandler_serial (int unit);  int open (path_conv *, int flags, mode_t mode);  int close ();  void init (HANDLE h, DWORD a, mode_t flags);  void overlapped_setup ();  int dup (fhandler_base *child);  int raw_read (void *ptr, size_t ulen);  int raw_write (const void *ptr, size_t ulen);  int tcsendbreak (int);  int tcdrain ();  int tcflow (int);  int ioctl (unsigned int cmd, void *);  int tcsetattr (int a, const struct termios *t);  int tcgetattr (struct termios *t);  __off64_t lseek (__off64_t, int) { return 0; }  int tcflush (int);  void dump ();  int is_tty () { return 1; }  void fixup_after_fork (HANDLE parent);  void fixup_after_exec (HANDLE);  /* We maintain a pgrp so that tcsetpgrp and tcgetpgrp work, but we     don't use it for permissions checking.  fhandler_tty_slave does     permission checking on pgrps.  */  virtual int tcgetpgrp () { return pgrp_; }  virtual int tcsetpgrp (const pid_t pid) { pgrp_ = pid; return 0; }  select_record *select_read (select_record *s);  select_record *select_write (select_record *s);  select_record *select_except (select_record *s);};#define acquire_output_mutex(ms) \  __acquire_output_mutex (__PRETTY_FUNCTION__, __LINE__, ms);#define release_output_mutex() \  __release_output_mutex (__PRETTY_FUNCTION__, __LINE__);class tty;class tty_min;class fhandler_termios: public fhandler_base{ protected:  HANDLE output_handle;  virtual void doecho (const void *, DWORD) {};  virtual int accept_input () {return 1;}; public:  tty_min *tc;  fhandler_termios (DWORD dev, int unit = 0) :  fhandler_base (dev, unit)  {    set_need_fork_fixup ();  }  HANDLE& get_output_handle () { return output_handle; }  int line_edit (const char *rptr, int nread, int always_accept = 0);  void set_output_handle (HANDLE h) { output_handle = h; }  void tcinit (tty_min *this_tc, int force = FALSE);  virtual int is_tty () { return 1; }  int tcgetpgrp ();  int tcsetpgrp (int pid);  bg_check_types bg_check (int sig);  virtual DWORD __acquire_output_mutex (const char *fn, int ln, DWORD ms) {return 1;}  virtual void __release_output_mutex (const char *fn, int ln) {}  void fixup_after_fork (HANDLE);  void fixup_after_exec (HANDLE parent) { fixup_after_fork (parent); }  void echo_erase (int force = 0);  virtual __off64_t lseek (__off64_t, int);};enum ansi_intensity{  INTENSITY_INVISIBLE,  INTENSITY_DIM,  INTENSITY_NORMAL,  INTENSITY_BOLD};#define normal 0#define gotesc 1#define gotsquare 2#define gotarg1 3#define gotrsquare 4#define gotcommand 5#define gettitle 6#define eattitle 7#define MAXARGS 10class dev_console{  WORD default_color, underline_color, dim_color;  /* Used to determine if an input keystroke should be modified with META. */  int meta_mask;/* Output state */  int state_;  int args_[MAXARGS];  int nargs_;  unsigned rarg;  bool saw_question_mark;  char my_title_buf [TITLESIZE + 1];  WORD current_win32_attr;  ansi_intensity intensity;  bool underline, blink, reverse;  WORD fg, bg;  /* saved cursor coordinates */  int savex, savey;  /* saved screen */  COORD savebufsiz;  PCHAR_INFO savebuf;  struct    {      short Top, Bottom;    } scroll_region;  struct    {      SHORT winTop;      SHORT winBottom;      COORD dwWinSize;      COORD dwBufferSize;      COORD dwCursorPosition;      WORD wAttributes;    } info;  COORD dwLastCursorPosition;  DWORD dwLastButtonState;  int nModifiers;  bool insert_mode;  bool use_mouse;  bool raw_win32_keyboard_mode;  friend class fhandler_console;};/* This is a input and output console handle */class fhandler_console: public fhandler_termios{ private:  static dev_console *dev_state;/* Output calls */  void set_default_attr ();  WORD get_win32_attr ();  BOOL fillin_info ();  void clear_screen (int, int, int, int);  void scroll_screen (int, int, int, int, int, int);  void cursor_set (BOOL, int, int);  void cursor_get (int *, int *);  void cursor_rel (int, int);  const unsigned char * write_normal (unsigned const char*, unsigned const char *);  void char_command (char);  BOOL set_raw_win32_keyboard_mode (BOOL);  int output_tcsetattr (int a, const struct termios *t);/* Input calls */  int igncr_enabled ();  int input_tcsetattr (int a, const struct termios *t);  void set_cursor_maybe (); public:  fhandler_console ();  fhandler_console* is_console () { return this; }  int open (path_conv *, int flags, mode_t mode = 0);  int write (const void *ptr, size_t len);  void doecho (const void *str, DWORD len) { (void) write (str, len); }  int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));  int close ();  int tcflush (int);  int tcsetattr (int a, const struct termios *t);  int tcgetattr (struct termios *t);  /* Special dup as we must dup two handles */  int dup (fhandler_base *child);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -