7 * bind a pipe onto consctl and keep reading it to
8 * get changes to console state.
18 x = segattach(0, "shared", 0, sizeof *x);
20 sysfatal("segattach: %r");
22 /* a pipe to simulate consctl */
23 if(bind("#|", "/mnt/consctl", MBEFORE) < 0
24 || bind("/mnt/consctl/data1", "/dev/consctl", MREPL) < 0)
25 sysfatal("bind consctl: %r");
27 /* a pipe to simulate the /dev/cons */
28 if(bind("#|", "/mnt/cons", MREPL) < 0
29 || bind("/mnt/cons/data1", "/dev/cons", MREPL) < 0)
30 sysfatal("bind cons: %r");
43 for(tries = 0; tries < 100; tries++){
46 fd = open("/mnt/cons/consctl/data", OREAD);
51 n = read(fd, buf, sizeof(buf)-1);
55 n = getfields(buf, field, 10, 1, " ");
56 for(i = 0; i < n; i++){
57 if(strcmp(field[i], "rawon") == 0)
59 else if(strcmp(field[i], "rawoff") == 0)
61 else if(strcmp(field[i], "holdon") == 0)
63 else if(strcmp(field[i], "holdoff") == 0)
70 return 0; /* dummy to keep compiler quiet*/