I know about the function shellOrigStdSet(), but what could I use for the
"fd" parameter?
I don't want to delete the shell task, as I want to be able to connect to it
from afar.
Any help would be much appreciated,
Pete.
#define CONSOLE_TTY NONE
This will ignore everything, including ctrl-x.
Alternatively open /dev/null and use ioGlobalStdSet() to fire stdin, stdout
and stderr down the hole :)
Something like:-
int fd = open("/dev/null",3);
ioGlobalStdSet(0,fd);
ioGlobalStdSet(1,fd);
ioGlobalStdSet(2,fd);
I'd try the first option by preference.
HTH,
Bob
In article <371f4...@nnrp1.news.uk.psi.net>, "Pete Cook"
Don't you mean /null rather than /dev/null? I have no /dev/null on
my system.
Chuck
Bob
In article <slrn7i0pi...@nasa2.ksc.nasa.gov>, c...@nasa2.ksc.nasa.gov
static void
beSilent(void)
{
/* redirect all this task's output to the bit bucket */
ioTaskStdSet(0, 1, -1);
ioTaskStdSet(0, 2, -1);
return;
}
static void
youMaySpeakNow(void)
{
/* return output to normal */
ioctl(1, FIOFLUSH, 0);
ioctl(2, FIOFLUSH, 0);
ioTaskStdSet(0, 1, 1);
ioTaskStdSet(0, 2, 2);
return;
}
-jw
--
Jim Wiggins - Contracted to Inter-Tel
We have added password security to our console, and task locking :
this required pulling the shell away from the console (as above).
Unfortunately the null device isn't very good at handling the 'In' bit-
I believe it returns instantly with an error - which is not what you
really want to be doing... (making the shell - priority 1 - spin!!!)
In combination with shellLock(), shellLogoutInstall, shellRestart() etc
you can then implement console shell security or whatever else you
require...
So...
write yourself a device driver that for 'write' operations returns
instantly with OK, and a read operation that just hangs.
Code fragments follow [including complete 'empty' driver
implementation]:
#define EMPTY_CONSOLE_DEV "/empty"
int emptyFd=open(EMPTY_CONSOLE_DEV,O_RDWR,0);
/* move STD_IN/OUT/ERR to an empty TTY device */
ioGlobalStdSet(STD_IN, emptyFd);
ioGlobalStdSet(STD_OUT, emptyFd);
ioGlobalStdSet(STD_ERR, emptyFd);
/* the EMPTY Device driver */
static int emptyRead(DEV_HDR *hdr,char *buf, int len)
{
taskSuspend(0);
return 0;
}
static int emptyWrite(DEV_HDR *hdr,char *buf, int len)
{
return len;
}
int createEmptyDev(void)
{
static DEV_HDR hdr;
int drvnum=iosDrvInstall(0,0,0,0,
(FUNCPTR)emptyRead,(FUNCPTR)emptyWrite,
0);
if(drvnum==ERROR)
return ERROR;
return iosDevAdd(&hdr,EMPTY_CONSOLE_DEV,drvnum);
}
sorry, but I can't post the rest of the shell security code :-(
- but its not that hard to completely replace the standard stuff with
your own code - we've got security around the bootline as well on
console and remote access.
HTH
regards
Ian Love,
The views expressed above are my own and not those of my employer