aboutsummaryrefslogtreecommitdiff
path: root/term/term.h
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2002-02-10 17:21:02 +0000
committerMarcus Brinkmann <marcus@gnu.org>2002-02-10 17:21:02 +0000
commite88c882ecc9557ea14734a418252c2c8a5d8caf9 (patch)
treeefcd54ffc50bff4a6649b65bded400937532997f /term/term.h
parent00269c069be2a461363f905f19a02bb013e7debf (diff)
downloadhurd-e88c882ecc9557ea14734a418252c2c8a5d8caf9.tar.gz
hurd-e88c882ecc9557ea14734a418252c2c8a5d8caf9.tar.bz2
hurd-e88c882ecc9557ea14734a418252c2c8a5d8caf9.zip
2002-02-10 Marcus Brinkmann <marcus@gnu.org>
* term.h: Include `hurd/hurd_types.h'. (struct bottomhalf): Change the return types of the following members from void to error_t: abandon_physical_output, suspend_physical_output, notice_input_flushed, desert_dtr, set_break, clear_break, start_output, set_bits (which now takes an struct termios * as argument), mdmctl and mdmstate (which now takes an int * as argument). Add new members init and type. (bottom): Define as const. (devio_bottom, ptyio_bottom): Declare as const. (drop_output): Change return type from void to error_t. (ptyio_init): Remove prototype. * devio.c (devio_abandon_physical_output): Change return value to error_t, and return 0. (devio_suspend_physical_output): Likewise. (devio_notice_input_flushed): Likewise. (devio_desert_dtr): Likewise. (devio_set_break): Likewise. (devio_clear_break): Likewise. (devio_start_output): Likewise. (devio_set_bits): Likewise. (devio_mdmctl): Likewise. (devio_mdmstate): Likewise. (init_devio): Rename to ... (devio_init): ... this. Do not give constructor attribute. Change return type to error_t, and return an error value, rather than bailing out. Declare as static. (devio_bottom): Add type TERM_ON_MACHDEV and init function devio_init. (devio_set_bits): Accept new argument STATE and use that to work out the terminal state, rather than changing the global termstate. (devio_mdmstate): Accept new argument STATE and use that to return the bits. * ptyio.c: Do not include `hurd/hurd_types.h'. (ptyio_suspend_physical_output): Change return value to error_t, and return 0. Likewise. (ptyio_notice_input_flushed): Likewise. (ptyio_desert_dtr): Likewise. (ptyio_set_bits): Likewise. (ptyio_set_break): Likewise. (ptyio_clear_break): Likewise. (ptyio_mdmctl): Likewise. (ptyio_start_output): Likewise. (ptyio_abandon_physical_output): Likewise. (ptyio_mdmstate): Likewise, and accept new argument STATE. (ptyio_init): Declare as static and change return type to error_t. (ptyio_bottom): Add type TERM_ON_MASTERPTY and init function ptyio_init. (ptyio_set_bits): Accept new argument STATE and use that to work out the terminal state, rather than changing the global termstate. (ptyio_mdmstate): Accept new argument STATE and use that to return the bits. * munge.c (drop_output): Change return value to error_t. Only clear queue if there was no error. * users.c (S_term_get_bottom_type): Just return bottom->type. (set_state): Rework logic to take possible errors into account, and to delay changing the termstate until we know that we won't fail. (S_tioctl_tiocflush): Return errors properly, and clear queue only if notice_input_flushed succeeded. (open_hook): Save error value of set_bits. Save old termflags and restore them if if set_bits failed. Call set_bits with correct arguments. (S_tioctl_tiocmods): Set err to result of mdmctl. (S_tioctl_tiocmset): Likewise. (S_tioctl_tiocmbic): Likewise. (S_tioctl_tiocmbis): Likewise. (S_tioctl_tioccdtr): Likewise. (S_tioctl_tiocsdtr): Likewise. (S_tioctl_tioccbrk): Likewise for clear_break. (S_tioctl_tiocsbrk): Likewise for set_break. (S_tioctl_tiocstart): Likewise for start_output. Save old termflags and restore them if if start_output failed. (S_tioctl_tiocstop): Likewise for stop_output. (S_trivfs_io_write): Abort the operation if start_output fails. Do not call start_output if it just failed, or if there was no data to be written. * main.c (main): Initialize bottom handler (rather than special casing this for ptyio). * users.c (open_hook): Use memcpy instead bcopy and memset instead bzero. (S_tioctl_tiocgeta): Likewise. (set_state): Likewise. (open_hook): Likewise. * munge.c (rescan_inputq): Likewise.
Diffstat (limited to 'term/term.h')
-rw-r--r--term/term.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/term/term.h b/term/term.h
index 565fe2f2..aafc844a 100644
--- a/term/term.h
+++ b/term/term.h
@@ -25,6 +25,7 @@
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
+#include <hurd/hurd_types.h>
#undef MDMBUF
#undef ECHO
@@ -140,22 +141,24 @@ mode_t term_mode;
/* Functions a bottom half defines */
struct bottomhalf
{
- void (*start_output) (void);
- void (*set_break) (void);
- void (*clear_break) (void);
- void (*abandon_physical_output) (void);
- void (*suspend_physical_output) (void);
+ enum term_bottom_type type;
+ error_t (*init) (void);
+ error_t (*start_output) (void);
+ error_t (*set_break) (void);
+ error_t (*clear_break) (void);
+ error_t (*abandon_physical_output) (void);
+ error_t (*suspend_physical_output) (void);
int (*pending_output_size) (void);
- void (*notice_input_flushed) (void);
+ error_t (*notice_input_flushed) (void);
error_t (*assert_dtr) (void);
- void (*desert_dtr) (void);
- void (*set_bits) (void);
- void (*mdmctl) (int, int);
- int (*mdmstate) (void);
+ error_t (*desert_dtr) (void);
+ error_t (*set_bits) (struct termios *state);
+ error_t (*mdmctl) (int how, int bits);
+ error_t (*mdmstate) (int *state);
};
-struct bottomhalf *bottom;
-extern struct bottomhalf devio_bottom, ptyio_bottom;
+const struct bottomhalf *bottom;
+extern const struct bottomhalf devio_bottom, ptyio_bottom;
/* Character queues */
@@ -313,7 +316,7 @@ void report_carrier_error (error_t);
/* Other decls */
-void drop_output (void);
+error_t drop_output (void);
void send_signal (int);
error_t drain_output ();
void output_character (int);
@@ -322,9 +325,6 @@ void rescan_inputq (void);
void write_character (int);
void init_users (void);
-/* Call this before using ptyio_bottom. */
-void ptyio_init (void);
-
/* kludge--these are pty versions of trivfs_S_io_* functions called by
the real functions in users.c to do work for ptys. */
error_t pty_io_write (struct trivfs_protid *, char *,