*** empty log message ***
This commit is contained in:
parent
e396496d8c
commit
73847b7d50
4 changed files with 33 additions and 23 deletions
|
@ -186,17 +186,23 @@ echo ""
|
|||
echo "0. No Ethernet card (no networking)"
|
||||
echo "1. An Intel Pro/100 Ethernet card is installed"
|
||||
echo "2. A Realtek 8139 Ethernet card is installed"
|
||||
echo "3. A different Ethernet card is installed (no networking)"
|
||||
echo "3. A Realtek 8029 Ethernet card is installed (emulated by Qemu)"
|
||||
echo "4. An NE2000, 3com 503 or WD based Ethernet card "
|
||||
echo " is installed (NE2000 is emulated by Bochs)"
|
||||
echo "5. A 3com 501 or 509 Ethernet card is installed "
|
||||
echo "6. A different Ethernet card is installed (no networking)"
|
||||
echo ""
|
||||
echo "You can always change your mind after the install."
|
||||
echo ""
|
||||
echo -n "Choice? "
|
||||
read eth
|
||||
driver=""
|
||||
inetparams=""
|
||||
case "$eth" in
|
||||
1) driver=FXP; inetparams="servers=inet;" ;;
|
||||
2) driver=RTL8139; inetparams="servers=inet;" ;;
|
||||
1) driver=fxp; ;;
|
||||
2) driver=rtl8139; ;;
|
||||
3) driver=dp8390; driverargs="dp8390_args='DPETH0=pci'"; ;;
|
||||
4) driver=dp8390; driverargs="#dp8390_args='DPETH0=port:irq:memory'"; ;;
|
||||
5) driver=dpeth; ;;
|
||||
esac
|
||||
|
||||
# Compute the amount of memory available to Minix.
|
||||
|
@ -375,7 +381,7 @@ if [ $cache -eq 0 ]; then cache=; else cache="ramsize=$cache"; fi
|
|||
|
||||
# Make bootable.
|
||||
installboot -d /dev/$root /usr/mdec/bootblock /boot/boot >/dev/null || exit
|
||||
edparams /dev/$root "rootdev=$root; ramimagedev=$root; $cache; $inetparams; main() { echo \"This is the MINIX 3 boot monitor.\"; echo \"MINIX will load in 5 seconds, or press ESC.\"; trap 5000 boot; menu; }; save" || exit
|
||||
edparams /dev/$root "rootdev=$root; ramimagedev=$root; $cache; main() { echo \"This is the MINIX 3 boot monitor.\"; echo \"MINIX will load in 5 seconds, or press ESC.\"; trap 5000 boot; menu; }; save" || exit
|
||||
pfile="/usr/src/tools/fdbootparams"
|
||||
echo "Remembering boot parameters in ${pfile}."
|
||||
echo "rootdev=$root; ramimagedev=$root; $cache; save" >$pfile || exit
|
||||
|
|
|
@ -169,6 +169,8 @@ PUBLIC void main(void)
|
|||
/* Initialize the TTY driver. */
|
||||
tty_init();
|
||||
|
||||
printf("\n");
|
||||
|
||||
/* Get kernel environment (protected_mode, pc_at and ega are needed). */
|
||||
if (OK != (s=sys_getmachine(&machine))) {
|
||||
panic("TTY","Couldn't obtain kernel environment.", s);
|
||||
|
@ -1503,7 +1505,6 @@ PRIVATE void tty_init()
|
|||
|
||||
register tty_t *tp;
|
||||
int s;
|
||||
|
||||
struct sigaction sigact;
|
||||
|
||||
/* Initialize the terminal lines. */
|
||||
|
|
|
@ -27,7 +27,7 @@ up to and including file descriptor
|
|||
, for reading, writing, or exceptional conditions, respectively.
|
||||
.B Select
|
||||
currently supports regular files, pipes, named pipes,
|
||||
inet, and tty file descriptors. Pty fd's still to be done.
|
||||
inet, and tty file descriptors (including pty).
|
||||
|
||||
If the
|
||||
.I readfds
|
||||
|
|
|
@ -30,6 +30,9 @@ void pipehandler(int sig)
|
|||
|
||||
}
|
||||
|
||||
#define CHILDFD 1
|
||||
#define PARENTFD 0
|
||||
|
||||
void do_child(int pty_fds[])
|
||||
{
|
||||
/* reads from pipe and prints out the data */
|
||||
|
@ -43,38 +46,38 @@ void do_child(int pty_fds[])
|
|||
signal(SIGUSR1, pipehandler);
|
||||
|
||||
/* first, close the write part, since it is not needed */
|
||||
close(pty_fds[1]);
|
||||
close(pty_fds[PARENTFD]);
|
||||
|
||||
while(1) {
|
||||
FD_ZERO(&fds_read);
|
||||
FD_ZERO(&fds_exception);
|
||||
FD_SET(pty_fds[0], &fds_read);
|
||||
FD_SET(pty_fds[0], &fds_exception);
|
||||
FD_SET(pty_fds[CHILDFD], &fds_read);
|
||||
FD_SET(pty_fds[CHILDFD], &fds_exception);
|
||||
timeout.tv_sec = 5;
|
||||
timeout.tv_usec = 0;
|
||||
retval = select(pty_fds[0]+1, &fds_read, NULL, &fds_exception, &timeout);
|
||||
retval = select(pty_fds[CHILDFD]+1, &fds_read, NULL, &fds_exception, &timeout);
|
||||
if (retval == -1) {
|
||||
perror("select");
|
||||
fprintf(stderr, "child: Error in select\n");
|
||||
continue;
|
||||
} else printf("child select: %d\n", retval);
|
||||
if (FD_ISSET(pty_fds[0], &fds_exception)) {
|
||||
if (FD_ISSET(pty_fds[CHILDFD], &fds_exception)) {
|
||||
printf("child: exception fd set. quitting.\n");
|
||||
break;
|
||||
}
|
||||
if (FD_ISSET(pty_fds[0], &fds_read)) {
|
||||
if (FD_ISSET(pty_fds[CHILDFD], &fds_read)) {
|
||||
printf("child: read fd set. reading.\n");
|
||||
if ((retval = read(pty_fds[0], data, sizeof(data))) < 0) {
|
||||
if ((retval = read(pty_fds[CHILDFD], data, sizeof(data))) < 0) {
|
||||
perror("read");
|
||||
fprintf(stderr, "child: couldn't read from pipe\n");
|
||||
fprintf(stderr, "child: couldn't read from pty\n");
|
||||
exit(-1);
|
||||
}
|
||||
if(retval == 0) {
|
||||
fprintf(stderr, "child: eof on pipe\n");
|
||||
fprintf(stderr, "child: eof on pty\n");
|
||||
break;
|
||||
}
|
||||
data[retval] = '\0';
|
||||
printf("pid %d eipe reads (%d): %s\n", getpid(), retval, data);
|
||||
printf("pid %d pty reads (%d): %s\n", getpid(), retval, data);
|
||||
} else printf("child: no fd set\n");
|
||||
}
|
||||
|
||||
|
@ -91,15 +94,15 @@ void do_parent(int pty_fds[])
|
|||
signal(SIGUSR1, pipehandler);
|
||||
|
||||
/* first, close the read part of pty, since it is not needed */
|
||||
close(pty_fds[0]);
|
||||
close(pty_fds[CHILDFD]);
|
||||
|
||||
/* now enter a loop of read user input, and writing it to the pty */
|
||||
while (1) {
|
||||
FD_ZERO(&fds_write);
|
||||
FD_SET(pty_fds[1], &fds_write);
|
||||
FD_SET(pty_fds[PARENTFD], &fds_write);
|
||||
printf("pid %d Waiting for pty ready to write on %s...\n",
|
||||
getpid(), name);
|
||||
retval = select(pty_fds[1]+1, NULL, &fds_write, NULL, NULL);
|
||||
retval = select(pty_fds[PARENTFD]+1, NULL, &fds_write, NULL, NULL);
|
||||
if (retval == -1) {
|
||||
perror("select");
|
||||
fprintf(stderr, "Parent: Error in select\n");
|
||||
|
@ -113,11 +116,11 @@ void do_parent(int pty_fds[])
|
|||
}
|
||||
if (!strcmp(data, "exit"))
|
||||
break;
|
||||
if (!FD_ISSET(pty_fds[1], &fds_write)) {
|
||||
if (!FD_ISSET(pty_fds[PARENTFD], &fds_write)) {
|
||||
fprintf(stderr, "parent: write fd not set?! retrying\n");
|
||||
continue;
|
||||
}
|
||||
retval = write(pty_fds[1], &data, 1024);
|
||||
retval = write(pty_fds[PARENTFD], &data, 1024);
|
||||
if (retval == -1) {
|
||||
perror("write");
|
||||
fprintf(stderr, "Error writing on pty\n");
|
||||
|
@ -126,7 +129,7 @@ void do_parent(int pty_fds[])
|
|||
}
|
||||
|
||||
/* got exit from user */
|
||||
close(pty_fds[1]); /* close pty, let child know we're done */
|
||||
close(pty_fds[PARENTFD]); /* close pty, let child know we're done */
|
||||
wait(&retval);
|
||||
printf("Child exited with status: %d\n", retval);
|
||||
exit(0);
|
||||
|
|
Loading…
Reference in a new issue