From: Sapan Bhatia Date: Mon, 25 Feb 2008 15:40:04 +0000 (+0000) Subject: Hardcoded config required for planetflow. This is temporary, till NodeManager impleme... X-Git-Tag: vsys-0.7-4~37 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=30c6f2e1c7ee57086d36b1d61287f97bbe98ffed;p=vsys.git Hardcoded config required for planetflow. This is temporary, till NodeManager implements this function. --- diff --git a/vsys-initscript b/vsys-initscript index 58eb450..8490147 100755 --- a/vsys-initscript +++ b/vsys-initscript @@ -38,6 +38,7 @@ case "$1" in stop) echo -n "Stopping $name:" killproc $name + killproc $name RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f ${lockfile} ${pidfile} diff --git a/vsys.spec b/vsys.spec index 777c1f3..81a9f93 100644 --- a/vsys.spec +++ b/vsys.spec @@ -49,6 +49,8 @@ make %install mkdir -p $RPM_BUILD_ROOT/usr/bin mkdir -p $RPM_BUILD_ROOT/etc/init.d +mkdir -p $RPM_BUILD_ROOT/vsys +cp factory/* $RPM_BUILD_ROOT/vsys cp vsys $RPM_BUILD_ROOT/usr/bin cp vsys-initscript $RPM_BUILD_ROOT/etc/init.d/vsys @@ -58,6 +60,7 @@ rm -rf $RPM_BUILD_ROOT %files /usr/bin/vsys /etc/init.d/vsys +/vsys/* %post chkconfig --add vsys diff --git a/vsyssh/vsyssh.c b/vsyssh/vsyssh.c index 105f565..9deb5ba 100644 --- a/vsyssh/vsyssh.c +++ b/vsyssh/vsyssh.c @@ -25,36 +25,41 @@ int main(int argc, char **argv, char **envp) { if (argc<2) { - printf("Usage: vsyssh \n"); + printf("Usage: vsyssh [cmd]\n"); exit(1); } else { int vfd0,vfd1; char *inf,*outf; + struct timeval tv; + inf=(char *)malloc(strlen(argv[1])+3); - outf=(char *)malloc(strlen(argv[2])+4); + outf=(char *)malloc(strlen(argv[1])+4); strcpy(inf,argv[1]); - strcpy(outf,argv[2]); + strcpy(outf,argv[1]); strcat(inf,".in"); strcat(outf,".out"); + tv.tv_sec = 100; + tv.tv_usec = 0; - vfd1 = open(inf,O_WRONLY); - vfd0 = open(outf,O_RDONLY); + vfd1 = open(inf,O_WRONLY|O_NONBLOCK); + vfd0 = open(outf,O_RDONLY|O_NONBLOCK); if (vfd0==-1 || vfd1 == -1) { printf("Error opening vsys entry %s\n", argv[1]); exit(1); } - if (argc<3) { fd_set set; FD_ZERO(&set); - FD_SET(0,&set); - FD_SET(vfd0,&set); + FD_SET(0, &set); + FD_SET(vfd0, &set); + while (1) { int ret; - ret = select(2, &set, NULL, NULL, NULL); + printf("vsys>"); + ret = select(vfd0+1, &set, NULL, NULL, &tv); if (FD_ISSET(0,&set)) { char lineread[2048]; int ret;