+++ /dev/null
-##################################################################
-# This file defines probes for local features that sfio requires.
-# Such probes are interpreted by the "iffe" language interpreter.
-# Results are stored in the FEATURE directory.
-# Written by Kiem-Phong Vo (06/27/92).
-# Converted to sfio v10/01/94 by Giampiero Sierra (06/08/95).
-##################################################################
-
-##################################################
-# file control checks
-##################################################
-
-tmp rmfail note{ file not removable if still opened }end execute{
- #include <sys/time.h>
- _BEGIN_EXTERNS_
- extern int creat(char*, int);
- extern int unlink(char*);
- extern int write(int, char*, int);
- _END_EXTERNS_
- main()
- { int fw, fr;
- char file[128];
- sprintf(file,"/tmp/iffe%lu",(unsigned long)time(0));
- if((fw = creat(file,0666)) < 0)
- return 0;
- if((fr = open(file,0)) < 0 )
- return 0;
- if(unlink(file) < 0)
- return 0;
- if(write(fw,"0123456789",11) != 11 )
- return 0;
- if(read(fr,file,11) != 11)
- return 0;
- if(strcmp(file,"0123456789") != 0)
- return 0;
- return 1;
- }
-}end
-
-more void_int note{ voidptr is larger than int }end execute{
- main() {
- return sizeof(char*) > sizeof(int) ? 0 : 1;
- }
-}end
-
-more long_int note{ long is larger than int }end execute{
- main() {
- return sizeof(long) > sizeof(int) ? 0 : 1;
- }
-}end
-
-################################################################
-# See if there is a preferred block size for a file system
-################################################################
-
-stat blksize note{ st_blksize is a field in struct stat }end compile{
- #include <sys/types.h>
- #include <sys/stat.h>
- main () {
- struct stat sb;
- sb.st_blksize = 0;
- return 0;
- }
-}end
-
-##################################################
-# See if certain prototypes are required
-##################################################
-
-proto open note{ open() has a vararg prototype }end compile{
- #include <sys/types.h>
- #include <errno.h>
- #include <ctype.h>
- #include <fcntl.h>
-
- _BEGIN_EXTERNS_
- extern int open(const char*,int,...);
- _END_EXTERNS_
- main()
- {
- open("file",0);
- open("file",0,1);
- }
-}end
-
-lib poll_fd_1 note{ fd is first arg to poll() }end execute{
- #include <poll.h>
- _BEGIN_EXTERNS_
- extern int pipe(int*);
- _END_EXTERNS_
- main()
- { int rw[2];
- struct pollfd fd;
- if (pipe(rw) < 0) return 1;
- fd.fd = rw[0];
- fd.events = POLLIN;
- fd.revents = 0;
- return poll(&fd, 1, 0) < 0;
- }
-}end
-
-lib poll_fd_2 note{ fd is second arg to poll() }end execute{
- #include <poll.h>
- _BEGIN_EXTERNS_
- extern int pipe(int*);
- _END_EXTERNS_
- main()
- { int rw[2];
- struct pollfd fd;
- if (pipe(rw) < 0) return 1;
- fd.fd = rw[0];
- fd.events = POLLIN;
- fd.revents = 0;
- return poll(1, &fd, 0) < 0;
- }
-}end
-
-################################################################
-## See if we can peek ahead in unseekable devices
-################################################################
-
-stream peek note{ ioctl(I_PEEK) works }end link{
- #include <sys/types.h>
- #include <stropts.h>
- main()
- { struct strpeek pbuf;
- pbuf.flags = 0;
- pbuf.ctlbuf.maxlen = pbuf.databuf.maxlen =
- pbuf.ctlbuf.len = pbuf.databuf.len = 0;
- pbuf.ctlbuf.buf = pbuf.databuf.buf = 0;
- ioctl(0,I_PEEK,&pbuf);
- return 0;
- }
-}end
-
-socket peek note{ recv(MSG_PEEK) works }end link{
- #include <sys/types.h>
- #include <sys/socket.h>
- main()
- { char buf[128];
- recv(0,buf,sizeof(buf),MSG_PEEK);
- return 0;
- }
-}end