tpoll.c revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1999-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#include "sftest.h"
#if _sys_socket
#endif
tmain()
{
int c;
char *s;
int fd[2];
if(argc > 1)
}
texit(0);
}
terror("Opening string stream");
terror("pipe failed");
terror("Opening read pipe stream");
terror("Opening write pipe stream");
terror("Only str should be available c=%d",c);
terror("Pipe stream should not be ready");
terror("Pipe read should be ready");
terror("Didn't get back right data");
terror("Only str should be available2");
terror("Both str&pipe write should be available");
terror("Can't create pipe");
terror("Can't create stream");
terror("Can't write to pipe");
terror("Data should be available");
if(!(f = sfpopen(0, s, "w+")) )
/* this write does not flush yet */
terror("Writing to pipe");
terror("Poll should succeed");
terror("Read should not be ready");
terror("Write should be ready");
if(sfsync(f) < 0) /* now flush data to the child process */
terror("Bad sync");
terror("Poll should succeed2");
terror("Read should be ready");
terror("Write should be ready");
terror("Bad read");
#if _lib_socketpair
terror("socketpair failed");
terror("Can't create stream with socket file descriptor");
terror("Can't create stream with socket file descriptor");
/* turn off write-capability for f */
sf[0] = f;
sf[1] = g;
terror("Exactly one stream should be ready!");
if(sf[0] != g)
terror("Stream g should be ready");
terror("Read should not be ready for g");
terror("Write should be ready for g");
terror("Writing to g socket");
terror("Poll should succeed with both streams");
terror("Read should be ready for f");
if(sfgetc(f) != 'a' )
terror("sfgetc failed");
/* turn back on write-capability for f */
terror("Writing to f socket");
terror("Poll should succeed for both streams");
terror("Read should be ready for f");
terror("Read should be ready for g");
terror("f gets wrong data");
terror("g gets wrong data");
terror("Poll should succeed for both streams");
terror("Read should not be ready for f");
terror("Read should not be ready for g");
#endif
texit(0);
}