* conform/conformtest.pl (@headers): Add monetary.h-data,
	mqueue.h-data, ndbm.h-data, nl_types.h-data, and poll.h-data.
	* conform/data/monetary.h-data: New file.
	* conform/data/mqueue.h-data: New file.
	* conform/data/ndbm.h-data: New file.
	* conform/data/nl_types.h.h-data: New file.
	* conform/data/poll.h-data: New file.
This commit is contained in:
Ulrich Drepper 1999-08-25 01:33:54 +00:00
parent 248286e533
commit 7b5fd91d77
8 changed files with 200 additions and 1 deletions

View File

@ -1,5 +1,13 @@
1999-08-24 Ulrich Drepper <drepper@cygnus.com>
* conform/conformtest.pl (@headers): Add monetary.h-data,
mqueue.h-data, ndbm.h-data, nl_types.h-data, and poll.h-data.
* conform/data/monetary.h-data: New file.
* conform/data/mqueue.h-data: New file.
* conform/data/ndbm.h-data: New file.
* conform/data/nl_types.h.h-data: New file.
* conform/data/poll.h-data: New file.
* stdio-common/Makefile (test): Add tst-cookie.
* stdio-common/tst-cookie.c: New file.

View File

@ -4,7 +4,8 @@ $CC = "gcc";
$CFLAGS = "-I. '-D__attribute__(x)=' -D_XOPEN_SOURCE=500";
# List of the headers we are testing.
@headers = ("math.h", "locale.h", "libgen.h", "langinfo.h", "iso646.h",
@headers = ("poll.h", "nl_types.h", "ndbm.h", "mqueue.h", "monetary.h",
"math.h", "locale.h", "libgen.h", "langinfo.h", "iso646.h",
"inttypes.h", "iconv.h", "grp.h", "glob.h", "ftw.h", "fnmatch.h",
"fmtmsg.h", "float.h", "fcntl.h", "errno.h", "dlfcn.h", "dirent.h",
"ctype.h", "cpio.h", "assert.h", "aio.h");

View File

@ -0,0 +1,8 @@
#if !defined ISO && !defined POSIX
type size_t
type ssize_t
function ssize_t strfmon (char*, size_t, const char*, ...)
allow *_t
#endif

View File

@ -0,0 +1,28 @@
#ifndef ISO
# should test for not an array type.
type mqd_t
type {struct sigevent}
type {struct mq_attr}
element {struct mq_attr} long mq_flags
element {struct mq_attr} long mq_maxmsg
element {struct mq_attr} long mq_msgsize
element {struct mq_attr} long mq_curmsg
function int mq_close (mqd_t)
function int mq_getattr (mqd_t, struct mq_attr*)
function int mq_notify (mqd_t, const struct sigevent*)
function mqd_t mq_open (const char*, int, ...)
function ssize_t mq_receive (mqd_t, char*, size_t, unsigned int*)
function int mq_send (mqd_t, const char*, size_t, unsigned int)
function int mq_setattr (mqd_t, const struct mq_attr*, struct mq_attr*)
function int mq_unlink (const char*)
allow-header fcntl.h
allow-header signal.h
allow-header sys/types.h
allow-header time.h
allow *_t
#endif

26
conform/data/ndbm.h-data Normal file
View File

@ -0,0 +1,26 @@
#if !defined ISO && !defined POSIX
type datum
element datum {void*} dptr
element datum size_t dsize
type size_t
type DBM
type mode_t
constant DBM_INSERT
constant DBM_REPLACE
function int dbm_clearerr (DBM*)
function void dbm_close (DBM*)
function int dbm_delete (DBM*, datum)
function int dbm_error (DBM*)
function datum dbm_fetch (DBM*, datum)
function datum dbm_firstkey (DBM*)
function datum dbm_nextkey (DBM*)
function {DBM*} dbm_open (const char*, int, mode_t)
function int dbm_store (DBM*, datum, datum, int)
allow *_t
#endif

View File

@ -0,0 +1,13 @@
#if !defined ISO && !defined POSIX
type nl_catd
type nl_item
constant NL_SETD
constant NL_CAT_LOCALE
function int catclose (nl_catd)
function {char*} catgets (nl_catd, int, int, char char*)
function nl_catd catopen (const char*, int)
allow *_t
#endif

23
conform/data/poll.h-data Normal file
View File

@ -0,0 +1,23 @@
#if !defined ISO && !defined POSIX
type {struct pollfd}
element {struct pollfd} int fd
element {struct pollfd} {short int} events
element {struct pollfd} {short int} revents
type nfds_t
constant POLLIN
constant POLLRDNORM
constant POLLRDBAND
constant POLLPRI
constant POLLOUT
constant POLLWRNORM
constant POLLWRBAND
constant POLLERR
constant POLLHUP
constant POLLNVAL
function int poll (struct pollfd[], nfsd_t, int)
allow *_t
#endif

92
stdio-common/tst-cookie.c Normal file
View File

@ -0,0 +1,92 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#define THE_COOKIE ((void *) 0xdeadbeeful)
static int errors;
static int cookieread_called;
static ssize_t
cookieread (void *cookie, char *buf, size_t count)
{
printf ("`%s' called with cookie %#lx\n", __FUNCTION__,
(unsigned long int) cookie);
if (cookie != THE_COOKIE)
++errors;
cookieread_called = 1;
return 42;
}
static int cookiewrite_called;
static ssize_t
cookiewrite (void *cookie, const char *buf, size_t count)
{
printf ("`%s' called with cookie %#lx\n", __FUNCTION__,
(unsigned long int) cookie);
if (cookie != THE_COOKIE)
++errors;
cookiewrite_called = 1;
return 43;
}
static int cookieseek_called;
static int
cookieseek (void *cookie, off_t offset, int whence)
{
printf ("`%s' called with cookie %#lx\n", __FUNCTION__,
(unsigned long int) cookie);
if (cookie != THE_COOKIE)
++errors;
cookieseek_called = 1;
return 44;
}
static int cookieclose_called;
static int
cookieclose (void *cookie)
{
printf ("`%s' called with cookie %#lx\n", __FUNCTION__,
(unsigned long int) cookie);
if (cookie != THE_COOKIE)
++errors;
cookieclose_called = 1;
return 45;
}
int
main (void)
{
cookie_io_functions_t fcts;
char buf[1];
FILE *f;
fcts.read = cookieread;
fcts.seek = cookieseek;
fcts.close = cookieclose;
fcts.write = cookiewrite;
f = fopencookie (THE_COOKIE, "r+", fcts);
fread (buf, 1, 1, f);
fwrite (buf, 1, 1, f);
fseek (f, 0, SEEK_CUR);
fclose (f);
if (cookieread_called == 0
|| cookiewrite_called == 0
|| cookieseek_called == 0
|| cookieclose_called == 0)
++errors;
return errors != 0;
}