user/usertests.c
void
bigargtest(void)
{
  int pid, fd;

  unlink("bigarg-ok");
  pid = fork();
  if(pid == 0){
    static char *args[MAXARG];
    int i;
    for(i = 0; i < MAXARG-1; i++)
      args[i] = "bigargs test: failed\n                                                                                                                                                                                                       ";
    args[MAXARG-1] = 0;
    printf("bigarg test\n");
    exec("echo", args);
    printf("bigarg test ok\n");
    fd = open("bigarg-ok", O_CREATE);
    close(fd);
    exit(0);
  } else if(pid < 0){
    printf("bigargtest: fork failed\n");
    exit(1);
  }
  wait(0);
  fd = open("bigarg-ok", 0);
  if(fd < 0){
    printf("bigarg test failed!\n");
    exit(1);
  }
  close(fd);
  unlink("bigarg-ok");
}
// does exec return an error if the arguments
// are larger than a page? or does it write
// below the stack and wreck the instructions/data?
does exec return an error if the arguments
are larger than a page.
does exec return an error if the arguments are larger than a page .
void
bigargtest(void)
{
  int pid, fd;
  unlink("bigarg-ok");
  pid = fork();
  if(pid == 0){
    static char *args[MAXARG];
    int i;
    for(i = 0; i < MAXARG-1; i++)
      args[i] = "bigargs test: failed\n                                                                                                                                                                                                       ";
    args[MAXARG-1] = 0;
    printf("bigarg test\n");
    exec("echo", args);
    printf("bigarg test ok\n");
    fd = open("bigarg-ok", O_CREATE);
    close(fd);
    exit(0);
  } else if(pid < 0){
    printf("bigargtest: fork failed\n");
    exit(1);
  }
  wait(0);
  fd = open("bigarg-ok", 0);
  if(fd < 0){
    printf("bigarg test failed!\n");
    exit(1);
  }
  close(fd);
  unlink("bigarg-ok");
}
void bigargtest ( void ) { int pid , fd ; unlink ( " " ) ; pid = fork ( ) ; if ( pid == 0 ) { static char * args [ MAXARG ] ; int i ; for ( i = 0 ; i < MAXARG - 1 ; i ++ ) args [ i ] = " \n " ; args [ MAXARG - 1 ] = 0 ; printf ( " \n " ) ; exec ( " " , args ) ; printf ( " \n " ) ; fd = open ( " " , O_CREATE ) ; close ( fd ) ; exit ( 0 ) ; } else if ( pid < 0 ) { printf ( " \n " ) ; exit ( 1 ) ; } wait ( 0 ) ; fd = open ( " " , 0 ) ; if ( fd < 0 ) { printf ( " \n " ) ; exit ( 1 ) ; } close ( fd ) ; unlink ( " " ) ; }
does exec return an error if the arguments
are larger than a page?
does exec return an error if the arguments are larger than a page?