[comp.os.os9] Porting UNIX code to OS/9-68K

davidb@titan.inmos.co.uk (David Boreham) (06/23/89)

What is involved in porting UNIX programs to OS/9-69000 ??

Well, I used to do a lot of this, and still do some, but the best
I can do is give some pointers. Mabe someone else out there has
the complete picture:

1) The file system is similar in that it is hierarchical and uses
   slashes. It does not allow links and has roots for each disk.
   As far as I know, all UNIX code doing disk file I/O works.
   Directory accesses work if the UNIX program is BSD.
   Many directories which you expect to find on a UNIX filesystem
   are absent (/etc, /usr....)

2) Yes the library supports many UNIX calls (more now than it used
   to). However, the main omissions are fork() and isatty().
   Both of these cause major problems.
   I have in the past implemented my own isatty() by poking around
   in the file descriptors and so on. fork() is rather difficult
   since the OS-9 process creation mechanism is not like fork().
   I usually re-write the code to use the OS-9 process creation
   call, but that's obviously not always convenient.

3) You don't have timers.

4) Any UNIX code which plays around with ioctl() and modifying
   terminal characteristics will need re-written to use 
   the OS-9 calls.

5) The new OS-9 TCP/IP has sockets, provided by a thing called
   "socketman". I'm not sure exactly what this is yet.

6) Some UNIX programs use system() to invoke utilities like
   "ls". Obviously these will not be present on an OS-9 system.
   (Unless you have ported them -:)

There are masses of things which are different but these are
the ones which have caused me grief. However, you certainly
can get pretty far porting UNIX code to OS9/68000. For instance,
I've had "yacc", "lex", "kermit" and many other things going
without much trouble. (I don't think X11 will work :)

David Boreham, INMOS Limited | mail(uk): davidb@inmos.co.uk or ukc!inmos!davidb
Bristol,  England            |      (us): uunet!inmos-c!davidb
+44 454 616616 ex 543        | Internet : @col.hp.com:davidb@inmos-c

ocker@lan.informatik.tu-muenchen.dbp.de (Wolfgang Ocker) (06/27/89)

In article <1625@brwa.inmos.co.uk> davidb@inmos.co.uk () writes:
>What is involved in porting UNIX programs to OS/9-69000 ??
>2) Yes the library supports many UNIX calls (more now than it used
>   to). However, the main omissions are fork() and isatty().
>   Both of these cause major problems.

fork() is a real problem, isatty() not:

#include <sgstat.h>

/*
 * i s w h a t
 */
static int iswhat(p)
  int p;
{
  struct  _sgs  opt;

  if (_gs_opt(p, &opt) < 0)
    return(-1);
  return(opt._sgs_class);
}

/*
 * i s a t t y
 */
int isatty(f)
  int f;
{
  int t;
		      
  if ((t = iswhat(f)) < 0)
    return(0);

  return(t == 0);
}


/*
 * i s a p i p e
 */
int isapipe(f)
  int f;
{
  int t;
				      
  if ((t = iswhat(f)) < 0)
    return(0);

  return(t == 1);
}


>3) You don't have timers.

But they are near. In 2.2 alarms are implemented, but don't
work correctly in all cases.

>There are masses of things which are different but these are
>the ones which have caused me grief. However, you certainly
>can get pretty far porting UNIX code to OS9/68000. For instance,
>I've had "yacc", "lex", "kermit" and many other things going
>without much trouble. (I don't think X11 will work :)

X11.R3 runs on OSK (I have seen it with my own eyes.) A company
in Germany has ported it.

Regards,
/// Wolfgang
-- 
  |  Wolfgang Ocker          |  ocker@lan.informatik.tu-muenchen.dbp.de  |
  |  Lochhauserstr. 35a      |      pyramid!tmpmbx!recco!weo (home)      |
  |  D-8039 Puchheim         |     Technische Universitaet Muenchen      |
  |  Voice: +49 89 80 77 02  |          Huh, What? Where am I?           |

kim@mcrware.UUCP (Kim Kempf) (07/03/89)

In article <1103@infovax.lan.informatik.tu-muenchen.dbp.de> ocker@lan.informatik.tu-muenchen.dbp.de (Wolfgang Ocker) writes:
>X11.R3 runs on OSK (I have seen it with my own eyes.) A company
>in Germany has ported it.
>
True, but it's hardware assisted.  Eltec GMBH makes a co-processor that
supports X11.R3 for OS-9.  As far as I know, the code they have does not yet
run stand alone on OS-9 without the coprocessor board.  It's still quite a
nice arrangement!
-- 
----------------
Kim Kempf, Microware Systems Corporation	{sun,uunet}!mcrware!kim

ocker@lan.informatik.tu-muenchen.dbp.de (Wolfgang Ocker) (07/10/89)

In article <1268@mcrware.UUCP> kim@mcrware.UUCP (Kim Kempf) writes:
>In article <1103@infovax.lan.informatik.tu-muenchen.dbp.de> ocker@lan.informatik.tu-muenchen.dbp.de (Wolfgang Ocker) writes:
>>X11.R3 runs on OSK (I have seen it with my own eyes.) A company
>>in Germany has ported it.
>True, but it's hardware assisted.  Eltec GMBH makes a co-processor that
>supports X11.R3 for OS-9.  As far as I know, the code they have does not yet
>run stand alone on OS-9 without the coprocessor board.  It's still quite a
>nice arrangement!

No, no special board is necessary. The X server runs
directly on OSK. The DDX layer is, of course, adapted for their
graphics hardware. For IPC they use self written filemanagers/
drivers.

Regards,
/// Wolfgang
-- 
  |  Wolfgang Ocker          |  ocker@lan.informatik.tu-muenchen.dbp.de  |
  |  Lochhauserstr. 35a      |      pyramid!tmpmbx!recco!weo (home)      |
  |  D-8039 Puchheim         |     Technische Universitaet Muenchen      |
  |  Voice: +49 89 80 77 02  |          Huh, What? Where am I?           |

grunwald@Katmandu.ira.uka.de (Grunwald Betr. Tichy) (07/10/89)

X is hardware assisted on ELTEC boards, but is hardware assited on most
UNIX systems too. Of course, you have to pot the device dependent parts to
your system, but that's true for any system not yet supported.
What's true too is, X is not very fast, but very big. But I think, the 
X-Software is worth porting X.