summaryrefslogtreecommitdiff
path: root/sys/lib/libsa
diff options
context:
space:
mode:
Diffstat (limited to 'sys/lib/libsa')
-rw-r--r--sys/lib/libsa/unixdev.c78
-rw-r--r--sys/lib/libsa/unixdev.h13
2 files changed, 57 insertions, 34 deletions
diff --git a/sys/lib/libsa/unixdev.c b/sys/lib/libsa/unixdev.c
index cb98acd0cfb..396ddb3510e 100644
--- a/sys/lib/libsa/unixdev.c
+++ b/sys/lib/libsa/unixdev.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: unixdev.c,v 1.3 1997/03/30 20:15:06 mickey Exp $ */
+/* $OpenBSD: unixdev.c,v 1.4 1998/05/25 18:37:30 mickey Exp $ */
/*
- * Copyright (c) 1996 Michael Shalayeff
+ * Copyright (c) 1996-1998 Michael Shalayeff
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,12 +36,12 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/syscall.h>
-#include <string.h>
#define open uopen
#include <sys/fcntl.h>
+#include <dev/cons.h>
#undef open
#include "libsa.h"
-#include "unixdev.h"
+#include <lib/libsa/unixdev.h>
int
unixstrategy(devdata, rw, blk, size, buf, rsize)
@@ -128,42 +128,51 @@ ulseek( fd, off, wh)
}
-int
-unix_probe()
+void
+unix_probe(cn)
+ struct consdev *cn;
{
- return 1;
+ cn->cn_pri = CN_INTERNAL;
+ cn->cn_dev = makedev(0,0);
+ printf("ux%d ", minor(cn->cn_dev));
}
void
-unix_putc(c)
- int c;
+unix_init(cn)
+ struct consdev *cn;
{
- uwrite(1, &c, 1);
}
-int
-unix_getc()
-{
+void
+unix_putc(dev, c)
+ dev_t dev;
int c;
- return uread(0, &c, 1)<1? -1: c;
+{
+ uwrite(1, &c, 1);
}
int
-unix_ischar()
+unix_getc(dev)
+ dev_t dev;
{
- struct timeval tv;
- fd_set fdset;
- int rc;
-
- tv.tv_sec = 0;
- tv.tv_usec = 100000;
- FD_ZERO(&fdset);
- FD_SET(0, &fdset);
-
- if ((rc = syscall(SYS_select, 1, &fdset, NULL, NULL, &tv)) <= 0)
- return 0;
- else
- return 1;
+ if (dev & 0x80) {
+ struct timeval tv;
+ fd_set fdset;
+ int rc;
+
+ tv.tv_sec = 0;
+ tv.tv_usec = 100000;
+ FD_ZERO(&fdset);
+ FD_SET(0, &fdset);
+
+ if ((rc = syscall(SYS_select, 1, &fdset, NULL, NULL, &tv)) <= 0)
+ return 0;
+ else
+ return 1;
+ } else {
+ char c;
+ return uread(0, &c, 1)<1? -1: c;
+ }
}
time_t
@@ -173,12 +182,25 @@ getsecs()
}
void
+time_print()
+{
+}
+
+void
atexit()
{
+}
+int
+cnspeed(dev, sp)
+ dev_t dev;
+ int sp;
+{
+ return 9600;
}
void
__main()
{
}
+
diff --git a/sys/lib/libsa/unixdev.h b/sys/lib/libsa/unixdev.h
index 8da2b088387..a113ae63854 100644
--- a/sys/lib/libsa/unixdev.h
+++ b/sys/lib/libsa/unixdev.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: unixdev.h,v 1.2 1997/04/02 05:26:42 mickey Exp $ */
+/* $OpenBSD: unixdev.h,v 1.3 1998/05/25 18:37:31 mickey Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -39,10 +39,11 @@ int unixopen __P((struct open_file *, ...));
int unixclose __P((struct open_file *));
int unixioctl __P((struct open_file *, u_long, void *));
-int unix_probe __P((void));
-int unix_getc __P((void));
-void unix_putc __P((int));
-int unix_ischar __P((void));
+void unix_probe __P((struct consdev *));
+void unix_init __P((struct consdev *));
+int unix_getc __P((dev_t));
+void unix_putc __P((dev_t, int));
+int unix_ischar __P((dev_t));
/* unixsys.S */
int uopen __P((const char *, int, ...));
@@ -51,6 +52,6 @@ int uwrite __P((int, void *, size_t));
int uioctl __P((int, u_long, char *));
int uclose __P((int));
off_t ulseek __P((int, off_t, int));
-void uexit __P((int));
+void uexit __P((int)) __attribute__((noreturn));
int syscall __P((int, ...));
int __syscall __P((quad_t, ...));