bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: the big term patch


From: Marcus Brinkmann
Subject: Re: the big term patch
Date: Fri, 8 Feb 2002 19:05:33 +0100
User-agent: Mutt/1.3.27i

On Fri, Feb 08, 2002 at 07:03:02PM +0100, Marcus Brinkmann wrote:
> here is a fix

pfft.

diff -ur term.new.old/ChangeLog term.new/ChangeLog
--- term.new.old/ChangeLog      Thu Feb  7 00:29:05 2002
+++ term.new/ChangeLog  Fri Feb  8 19:02:21 2002
@@ -1,4 +1,26 @@
-2002-02-07  Marcus Brinkmann  <marcus@212.23.136.22>
+2002-02-08  Marcus Brinkmann  <marcus@gnu.org>
+
+       * term.h (struct bottomhalf): Add new member init().
+       * main.c (main): Initialize bottom handler (rather than special
+       casing this for ptyio).
+       * ptyio.c (ptyio_init): Change return type to error_t and return
+       an error value.
+       (ptyio_bottom): Add ptyio_init.
+       * hurdio.c (init_hurdio): Renamed to ...
+       (hurdio_init): ... this.  Do not give constructor attribute.
+       Change return type to error_t, and return an error value.
+       (hurdio_bottom): Add hurdio_init.
+       * devio.c (init_devio): Rename to ...
+       (devio_init): ... this.  Do not give constructor attribute.
+       Change return type to error_t, and return an error value.
+       (devio_bottom): Add devio_init.
+
+       * main.c (main): Add `hurdio' as allowable type.
+
+       * main.c (main): Move bootstrap retrieval down just before
+       checking it.
+
+2002-02-07  Marcus Brinkmann  <marcus@gnu.org>
 
        * main.c (main): Add hurdio bottom handler case.
 
@@ -6,7 +28,7 @@
 
        * term.h (extern struct bottomhalf): Add hurdio_bottom.
 
-2002-02-06  Marcus Brinkmann  <marcus@212.23.136.22>
+2002-02-06  Marcus Brinkmann  <marcus@gnu.org>
 
        * users.c (set_state): Rework logic to take possible errors into
        account, and to delay changing the termstate until we know that we
diff -ur term.new.old/devio.c term.new/devio.c
--- term.new.old/devio.c        Thu Feb  7 01:17:11 2002
+++ term.new/devio.c    Fri Feb  8 18:42:39 2002
@@ -100,18 +100,17 @@
 /* Forward */
 static error_t devio_desert_dtr ();
 
-static void init_devio (void) __attribute__ ((constructor));
-static void
-init_devio ()
+error_t devio_init (void)
 {
   mach_port_t host_priv;
   error_t err;
 
   err = get_privileged_ports (&host_priv, &device_master);
   if (err)
-    error (1, err, "Getting priviliged ports");
+    return err;
   mach_port_deallocate (mach_task_self (), host_priv);
   phys_reply_class = ports_create_class (0, 0);
+  return 0;
 }
 
 /* XXX Convert a real speed to a bogus Mach speed.  Return
@@ -759,6 +758,7 @@
 
 struct bottomhalf devio_bottom =
 {
+  devio_init,
   devio_start_output,
   devio_set_break,
   devio_clear_break,
diff -ur term.new.old/hurdio.c term.new/hurdio.c
--- term.new.old/hurdio.c       Thu Feb  7 03:12:48 2002
+++ term.new/hurdio.c   Fri Feb  8 18:44:42 2002
@@ -86,15 +86,15 @@
 static error_t hurdio_set_bits (struct termios *state);
 
 
-static void init_hurdio (void) __attribute__ ((constructor));
-static void
-init_hurdio ()
+static error_t
+hurdio_init (void)
 {
   condition_init (&hurdio_writer_condition);
   condition_init (&hurdio_assert_dtr_condition);
 
   cthread_detach (cthread_fork (hurdio_reader_loop, 0));
   cthread_detach (cthread_fork (hurdio_writer_loop, 0));
+  return 0;
 }
 
 
@@ -576,6 +576,7 @@
 
 struct bottomhalf hurdio_bottom =
 {
+  hurdio_init,
   hurdio_start_output,
   hurdio_set_break,
   hurdio_clear_break,
diff -ur term.new.old/main.c term.new/main.c
--- term.new.old/main.c Thu Feb  7 00:25:51 2002
+++ term.new/main.c     Fri Feb  8 19:00:52 2002
@@ -68,8 +68,6 @@
 
   init_users ();
 
-  task_get_bootstrap_port (mach_task_self (), &bootstrap);
-  
   if (argc != 4)
     {
       fprintf (stderr, "Usage: term ttyname type arg\n");
@@ -125,10 +123,12 @@
   else
     {
       fprintf (stderr, 
-              "Allowable types are device, pty-master, and pty-slave.\n");
+              "Allowable types are device, hurdio, pty-master, and 
pty-slave.\n");
       exit (1);
     }
   
+  task_get_bootstrap_port (mach_task_self (), &bootstrap);
+  
   if (bootstrap == MACH_PORT_NULL)
     {
       fprintf (stderr, "Must be started as a translator\n");
@@ -206,8 +206,12 @@
   
   outputq = create_queue (256, QUEUE_LOWAT, QUEUE_HIWAT);
   
-  if (bottom == &ptyio_bottom)
-    ptyio_init ();
+  errno = (*bottom)->init ();
+  if (errno)
+    {
+      perror ("Initializing bottom handler");
+      exit (1);
+    }
 
   condition_init (&carrier_alert);
   condition_init (&select_alert);
diff -ur term.new.old/ptyio.c term.new/ptyio.c
--- term.new.old/ptyio.c        Thu Feb  7 00:28:44 2002
+++ term.new/ptyio.c    Fri Feb  8 18:58:52 2002
@@ -56,11 +56,12 @@
 static int nptyperopens = 0;
 
 
-void
-ptyio_init ()
+error_t
+ptyio_init (void)
 {
   condition_implies (inputq->wait, &pty_select_wakeup);
   condition_implies (&pty_read_wakeup, &pty_select_wakeup);
+  return 0;
 }
     
 error_t
@@ -273,6 +274,7 @@
 
 struct bottomhalf ptyio_bottom =
 {
+  ptyio_init,
   ptyio_start_output,
   ptyio_set_break,
   ptyio_clear_break,
diff -ur term.new.old/term.h term.new/term.h
--- term.new.old/term.h Thu Feb  7 00:28:44 2002
+++ term.new/term.h     Fri Feb  8 18:39:49 2002
@@ -140,6 +140,7 @@
 /* Functions a bottom half defines */
 struct bottomhalf
 {
+  error_t (*init) (void);
   error_t (*start_output) (void);
   error_t (*set_break) (void);
   error_t (*clear_break) (void);

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de



reply via email to

[Prev in Thread] Current Thread [Next in Thread]