struct chan chans
[NCHANS
];
struct group
*groups
[NGROUPS
];
register struct chan
*cp
;
for(cp
=chans
; cp
< &chans
[NCHANS
]; cp
++)
for(i
= NGROUPS
-1; i
>=0; i
--)
register struct chan
*cp
;
register struct group
*gp
;
cp
= (struct chan
*)gp
->g_chans
[i
];
if ((cp
=challoc(i
)) != NULL
) {
extern mxopen(), mcread();
extern struct chan
*addch();
struct file
*fp
,*chfp
,*gfp
;
* return a file descriptor
for(i
=0; linesw
[i
].l_open
; i
++)
if (linesw
[i
].l_read
== mcread
) {
for(i
=0; cdevsw
[i
].d_open
; i
++) {
if (cdevsw
[i
].d_open
== mxopen
)
if ((ip
=ialloc(rootdev
))==NULL
)
ip
->i_mode
= (u
.u_arg
[1]&0777)+IFCHR
;
ip
->i_flag
= IACC
|IUPD
|ICHG
;
ip
= maknode((u
.u_arg
[1]&0777)+IFCHR
);
if ((i
= gpalloc()) < 0) {
ip
->i_un
.i_rdev
= (daddr_t
)(mpxdev
+i
);
open1(ip
,FREAD
+FWRITE
,2);
fp
= u
.u_ofile
[u
.u_r
.r_val1
];
* join file descriptor (arg 0) to group (arg 1)
if ((fp
=getf(u
.u_arg
[0]))==NULL
)
dev
= (dev_t
)ip
->i_un
.i_rdev
;
tp
= &cdevsw
[major(dev
)].d_ttys
[minor(dev
)];
if (tp
==NULL
|| tp
->t_chan
)
if ((cp
=addch(gip
))==NULL
)
cp
->c_ottyp
= cp
->c_ittyp
= tp
;
cp
->c_iline
= cp
->c_oline
= tp
->t_line
;
u
.u_r
.r_val1
= cp
->c_index
;
* attach channel (arg 0) to group (arg 1)
cp
= xcp(gp
, u
.u_arg
[0]);
cp
= xcp(gp
, u
.u_arg
[0]);
* extract channel (arg 0) from group (arg 1)
* using X side (arg 2 zero) otherwise Y side
cp
= xcp(gp
, u
.u_arg
[0]);
if ((fp
= falloc()) == NULL
) {
fp
->f_flag
= (u
.u_arg
[2]) ? (FREAD
+FWRITE
+FMPY
) : (FREAD
+FWRITE
+FMPX
);
* make new chan on group (arg 1)
if ((cp
=addch(gip
))==NULL
)
cp
->c_ittyp
= cp
->c_ottyp
= (struct tty
*)cp
;
cp
->c_iline
= cp
->c_oline
= mpxline
;
u
.u_r
.r_val1
= cp
->c_index
;
* connect fd (arg 0) to channel fd (arg 1)
* (arg 2 < 0) => fd to chan only
* (arg 2 > 0) => chan to fd only
* (arg 2 == 0) => both directions
if ((fp
=getf(u
.u_arg
[0]))==NULL
)
if ((chfp
=getf(u
.u_arg
[1]))==NULL
)
dev
= (dev_t
)ip
->i_un
.i_rdev
;
tp
= &cdevsw
[major(dev
)].d_ttys
[minor(dev
)];
if (!(chfp
->f_flag
&FMPY
)) {
cp
->c_oline
= tp
->t_line
;
cp
->c_iline
= tp
->t_line
;
register struct proc
*pp
;
cp
= xcp(gp
, u
.u_arg
[0]);
cp
= xcp(gp
, u
.u_arg
[0]);
signal(cp
->c_pgrp
, u
.u_arg
[2]);
mcdebugs
[i
] = u
.u_arg
[1];
mcdebugs
[i
] = u
.u_arg
[1];
struct group
*sub
, *master
;
if (master
->g_chans
[i
] != NULL
)
master
->g_chans
[i
] = (struct chan
*)sub
;