Subject: Re: SOCK_SEQPACKET UNIX domain socket patch
To: None <cgd@broadcom.com>
From: Jesse Off <jesseoff@yahoo.com>
List: tech-kern
Date: 04/14/2003 23:18:15
> This seems pretty cool (to me at least).
> 
> Do you have any simple test programs that verify
> that they are working
> as intended?
> 

I can show you the test fragment I used.  Its not
really easily automatable since it requires a human to
look at the results and make sense of (and therefore
understand) what it should be doing.

#include <sys/socket.h>
#include <fcntl.h>
#include <errno.h>
#include <assert.h>
#include <stdio.h>

int main(void)
{
  char buf[4096];
  int i;
  int sk[2];
  int ret = socketpair(PF_LOCAL, SOCK_SEQPACKET, 0,
sk);
//  int ret = socketpair(PF_LOCAL, SOCK_DGRAM, 0, sk);
//  int ret = socketpair(PF_LOCAL, SOCK_STREAM, 0,
sk);

  assert(ret == 0);
  ret = fcntl(sk[1], F_SETFL, O_NONBLOCK);
  ret = fcntl(sk[0], F_SETFL, O_NONBLOCK);
  for(i = 0; i < 6; i++)
  {
    ret = write(sk[0], buf, 1024);
    printf("ret=%d\n", ret);
  }
  printf("errno=%s\n", strerror(errno));
  ret = 0;
  while(ret != -1)
  {
    ret = read(sk[1], buf, 512);
    printf("ret=%d\n", ret);
  }
  printf("errno=%s\n", strerror(errno));
}

//Jesse Off



__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com