2 hdr dirent,filio,jioctl,locale,mman,ndir,utime,vfork,wchar
4 lib _cleanup,BSDsetpgrp,atexit,bcopy,bzero,confstr,dirread,dup2,fchmod
5 lib fcntl,fnmatch,fork,fsync,getconf,getdents,getdirentries,getdtablesize
6 lib getgroups,getpagesize,getrlimit,getuniverse,index,killpg,link
7 lib localeconv,lstat,mbtowc,memccpy
8 lib memchr,memcmp,memcpy,memmove,memset,mkdir,mkfifo,mknod,mktemp
9 lib mount,on_exit,onexit,opendir,pathconf,readlink,remove,rename,rindex
10 lib rmdir,rewinddir,setlocale,setpgid,setpgrp,setpgrp2,setreuid,setsid
11 lib setuid,sigaction,sigprocmask,sigsetmask,sigvec
12 lib socketpair,spawnve,spawnveg,strchr,strcoll,strdup,strerror,strrchr
13 lib strtod,strtol,strtoul,strxfrm,symlink,sysconf
14 lib telldir,tmpnam,tzset,universe,unlink,utime,vfork
15 lib wctype,iswblank,iswctype
16 lib execve,pcreateve,NutForkExecve
17 mem direct.d_reclen sys/types.h sys/dir.h
18 mem dirent.d_fileno,dirent.d_ino,dirent.d_namlen,dirent.d_off,dirent.d_reclen sys/types.h dirent.h
19 mem DIR.dd_fd sys/types.h - dirent.h - sys/dir.h
20 sys dir,filio,jioctl,localedef,mman,ptem,resource,socket,stream,universe
23 tst tst_errno note{ errno can be assigned }end link{
29 main() { errno = 0; error(); strerror(); }
32 tst lib_poll_fd_1 note{ fd is first arg to poll() }end execute{
35 extern int pipe _ARG_((int*));
40 if (pipe(rw) < 0) return 1;
44 return poll(&fd, 1, 0) < 0;
48 tst lib_poll_fd_2 note{ fd is second arg to poll() }end execute{
51 extern int pipe _ARG_((int*));
56 if (pipe(rw) < 0) return 1;
60 return poll(1, &fd, 0) < 0;
65 #if _lib_poll_fd_1 || _lib_poll_fd_2
68 #if _lib_NutForkExecve
69 #define _map_spawnve NutForkExecve
72 #define _map_spawnve pcreateve
77 tst lib_poll_notimer note{ poll with no fds ignores timeout }end execute{
78 #include <sys/types.h>
81 extern time_t time _ARG_((time_t*));
89 start = time((time_t*)0);
90 if (poll(&fd, 0, TIMEOUT * 1000) < 0)
92 finish = time((time_t*)0);
93 return (finish - start) > (TIMEOUT / 2);
97 tst lib_select note{ select() has standard 5 arg interface }end link{
98 #include <sys/types.h>
100 #include <sys/socket.h>
102 { struct timeval tmb;
108 select(1,&rd,(fd_set*)0,(fd_set*)0,&tmb);
113 tst pipe_rw note{ full duplex pipes }end execute{
115 extern int pipe _ARG_((int*));
116 extern int read _ARG_((int, void*, int));
117 extern int strcmp _ARG_((const char*, const char*));
118 extern int write _ARG_((int, void*, int));
122 static char test[] = "test\n";
124 char buf[sizeof(test)];
125 if (pipe(io)) return 1;
126 if (write(io[1], test, sizeof(test)) != sizeof(test)) return 1;
127 if (read(io[0], buf, sizeof(test)) != sizeof(test)) return 1;
128 if (strcmp(test, buf)) return 1;
129 if (write(io[0], test, sizeof(test)) != sizeof(test)) return 1;
130 if (read(io[1], buf, sizeof(test)) != sizeof(test)) return 1;
131 if (strcmp(test, buf)) return 1;
136 tst real_vfork note{ vfork child shares data with parent }end execute{
139 extern int _exit(int);
145 if (!vfork()) code = 0;
150 tst stream_peek note{ ioctl(I_PEEK) works }end link{
151 #include <sys/types.h>
154 { struct strpeek pbuf;
156 pbuf.ctlbuf.maxlen = pbuf.databuf.maxlen =
157 pbuf.ctlbuf.len = pbuf.databuf.len = 0;
158 pbuf.ctlbuf.buf = pbuf.databuf.buf = 0;
159 ioctl(0,I_PEEK,&pbuf);
164 tst socket_peek note{ recv(MSG_PEEK) works }end link{
165 #include <sys/types.h>
166 #include <sys/socket.h>
169 recv(0,buf,sizeof(buf),MSG_PEEK);
174 tst lib_mmap sys/types.h sys/stat.h unistd.h fcntl.h mman.h sys/mman.h sys/times.h note{ standard mmap interface that works }end execute{
175 #define BUFSIZE (16*1024)
176 #define MAPSIZE (16*1024)
179 main(int argc, char** argv)
193 struct tms brdtm, erdtm, bmmtm, emmtm;
197 while (*t = *f++) t++;
201 /* create data file */
202 if ((fd = creat(file,0666)) < 0)
204 for (i = 0; i < sizeof(buf); ++i)
205 buf[i] = '0' + (i%10);
206 for (i = 0; i < WRITE; ++i)
207 if (write(fd,buf,sizeof(buf)) != sizeof(buf))
211 if ((fd = open(file, 0)) < 0)
214 for (i = 0; i < WRITE; ++i)
215 if (read(fd,buf,sizeof(buf)) != sizeof(buf))
219 /* memory map time */
220 if ((fd = open(file,0)) < 0)
224 for (i = 0; i < (WRITE/(MAPSIZE/BUFSIZE)); ++i)
225 { mm = (caddr_t)mmap(mm, MAPSIZE, (PROT_READ|PROT_WRITE),
226 (MAP_PRIVATE | (mm ? MAP_FIXED : 0)),
228 if(mm == (caddr_t)(-1) || mm == (caddr_t)0)
234 if(((erdtm.tms_utime-brdtm.tms_utime)+(erdtm.tms_stime-brdtm.tms_stime)) <=
235 ((emmtm.tms_utime-bmmtm.tms_utime)+(emmtm.tms_stime-bmmtm.tms_stime)) )
242 tst ptr_dd_buf sys/types.h - dirent.h - ndir.h - sys/dir.h note{ DIR.dd_buf is a pointer }end compile{
251 tst lib_utime_now note{ utime works with 0 time vector }end execute{
252 #include <sys/types.h>
254 extern int utime _ARG_((const char*, void*));
258 return utime(".", (void*)0) == -1;
264 case `/bin/cat -s /dev/null/foo 2>&1` in
266 *) case `/bin/echo '\\\\t'` in
271 echo "#define _UNIV_DEFAULT \\"$u\\" /* default universe name */"
274 std cleanup note{ stuck with standard _cleanup }end noexecute{
277 extern void exit _ARG_((int));
278 extern void _exit _ARG_((int));
279 extern void _cleanup();
280 void _cleanup() { _exit(0); }
282 main() { printf("cleanup\n"); exit(1); }
285 std malloc note{ stuck with standard malloc }end noexecute{
287 extern char* strdup _ARG_((const char*));
289 char* malloc(unsigned n) { return 0; }
291 char* malloc(n) unsigned n; { return 0; }
294 main() { return strdup("yo") != 0; }
297 std signal note{ stuck with standard signal }end nolink{
300 int signal() { return 0; }
302 main() { signal(); abort(); return 0; }
305 std strcoll note{ standard strcoll works }end execute{
307 #define S "hello world"
312 return strcoll(s, t) || strcmp(s, t);