summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2003-09-03 13:35:45 +0000
committerjlam <jlam@pkgsrc.org>2003-09-03 13:35:45 +0000
commitdeadfb61c807c5fec4bc3afb0a19e628c6b66b40 (patch)
treedf118a124d1c78933caa0a450779d496f1672656 /pkgtools
parent6e701252a80d2e180e52d9f5e9cc52582ddee33b (diff)
downloadpkgsrc-deadfb61c807c5fec4bc3afb0a19e628c6b66b40.tar.gz
Add and remove some files I forgot to in the last commit.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/err.h (renamed from pkgtools/libnbcompat/files/err.h)2
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/fts.h (renamed from pkgtools/libnbcompat/files/fts.h)2
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/nbconfig.h.in (renamed from pkgtools/libnbcompat/files/nbconfig.h.in)11
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/poll.h72
-rw-r--r--pkgtools/libnbcompat/files/nbcompat/statfs.h58
-rw-r--r--pkgtools/libnbcompat/files/poll.c97
-rw-r--r--pkgtools/libnbcompat/files/vis.h107
7 files changed, 236 insertions, 113 deletions
diff --git a/pkgtools/libnbcompat/files/err.h b/pkgtools/libnbcompat/files/nbcompat/err.h
index 139aeb766d6..b932c15c924 100644
--- a/pkgtools/libnbcompat/files/err.h
+++ b/pkgtools/libnbcompat/files/nbcompat/err.h
@@ -1,4 +1,4 @@
-/* $NetBSD: err.h,v 1.1 2003/07/31 22:40:27 jschauma Exp $ */
+/* $NetBSD: err.h,v 1.1 2003/09/03 13:35:50 jlam Exp $ */
/*
* Copyright (c) 1989, 1993
diff --git a/pkgtools/libnbcompat/files/fts.h b/pkgtools/libnbcompat/files/nbcompat/fts.h
index f0e5611d7d1..40a2429f20e 100644
--- a/pkgtools/libnbcompat/files/fts.h
+++ b/pkgtools/libnbcompat/files/nbcompat/fts.h
@@ -1,4 +1,4 @@
-/* $NetBSD: fts.h,v 1.1.1.1 2003/03/31 05:02:44 grant Exp $ */
+/* $NetBSD: fts.h,v 1.1 2003/09/03 13:35:51 jlam Exp $ */
/*
* Copyright (c) 1989, 1993
diff --git a/pkgtools/libnbcompat/files/nbconfig.h.in b/pkgtools/libnbcompat/files/nbcompat/nbconfig.h.in
index b30c5b636ad..6715c64c501 100644
--- a/pkgtools/libnbcompat/files/nbconfig.h.in
+++ b/pkgtools/libnbcompat/files/nbcompat/nbconfig.h.in
@@ -1,4 +1,4 @@
-/* nbconfig.h.in. Generated from configure.ac by autoheader. */
+/* nbcompat/nbconfig.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if the `getpgrp' function requires zero arguments. */
#undef GETPGRP_VOID
@@ -377,9 +377,6 @@
/* Define to 1 if the system has the type `u_int8_t'. */
#undef HAVE_U_INT8_T
-/* Define to 1 if you have the <vis.h> header file. */
-#undef HAVE_VIS_H
-
/* Define to 1 if you have the `vprintf' function. */
#undef HAVE_VPRINTF
@@ -424,8 +421,14 @@
#undef size_t
+/* Define to 1 if you have the <vis.h> header file. */
+#undef HAVE_VIS_H
+
/* NBCOMPAT template section follows. */
+/* Define to 1 if the `vis' function is built into the library. */
+#undef HAVE_NBCOMPAT_VIS
+
/* Define to 1 if the `statfs' function is built into the library. */
#undef HAVE_NBCOMPAT_STATFS
diff --git a/pkgtools/libnbcompat/files/nbcompat/poll.h b/pkgtools/libnbcompat/files/nbcompat/poll.h
new file mode 100644
index 00000000000..d4342cca56c
--- /dev/null
+++ b/pkgtools/libnbcompat/files/nbcompat/poll.h
@@ -0,0 +1,72 @@
+/* $NetBSD: poll.h,v 1.1 2003/09/03 13:35:52 jlam Exp $ */
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _POLL_H_
+#define _POLL_H_
+
+typedef unsigned int nfds_t;
+
+struct pollfd {
+ int fd; /* file descriptor */
+ short events; /* events to look for */
+ short revents; /* events returned */
+};
+
+/*
+ * Testable events (may be specified in events field).
+ */
+#define POLLIN 0x0001
+#define POLLPRI 0x0002
+#define POLLOUT 0x0004
+#define POLLRDNORM 0x0040
+#define POLLWRNORM POLLOUT
+#define POLLRDBAND 0x0080
+#define POLLWRBAND 0x0100
+
+/*
+ * Non-testable events (may not be specified in events field).
+ */
+#define POLLERR 0x0008
+#define POLLHUP 0x0010
+#define POLLNVAL 0x0020
+
+__BEGIN_DECLS
+int poll (struct pollfd *, nfds_t, int);
+__END_DECLS
+
+#endif /* !_POLL_H_ */
diff --git a/pkgtools/libnbcompat/files/nbcompat/statfs.h b/pkgtools/libnbcompat/files/nbcompat/statfs.h
new file mode 100644
index 00000000000..388ad975f7a
--- /dev/null
+++ b/pkgtools/libnbcompat/files/nbcompat/statfs.h
@@ -0,0 +1,58 @@
+/* $NetBSD: statfs.h,v 1.1 2003/09/03 13:35:53 jlam Exp $ */
+
+#ifndef _NBCOMPAT_STATFS_H
+#define _NBCOMPAT_STATFS_H
+
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#if HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+
+#if HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+
+#ifndef MFSNAMELEN
+#define MFSNAMELEN 16 /* length of fs type name, including nul */
+#endif
+#ifndef MNAMELEN
+#define MNAMELEN 90 /* length of buffer for returned name */
+#endif
+
+struct statfs {
+ short f_type; /* type of file system */
+ u_short f_flags; /* copy of mount flags */
+ long f_bsize; /* fundamental file system block size */
+ long f_iosize; /* optimal transfer block size */
+ long f_blocks; /* total data blocks in file system */
+ long f_bfree; /* free blocks in fs */
+ long f_bavail; /* free blocks avail to non-superuser */
+ long f_files; /* total file nodes in file system */
+ long f_ffree; /* free file nodes in fs */
+ fsid_t f_fsid; /* file system id */
+ uid_t f_owner; /* user that mounted the file system */
+ long f_spare[4]; /* spare for later */
+ char f_fstypename[MFSNAMELEN]; /* fs type name */
+ char f_mntonname[MNAMELEN]; /* directory on which mounted */
+ char f_mntfromname[MNAMELEN]; /* mounted file system */
+};
+
+#ifndef MNT_RDONLY
+#define MNT_RDONLY 0x00000001 /* read only filesystem */
+#endif
+
+#ifndef MNT_NOSUID
+#define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */
+#endif
+
+int statfs(const char *path, struct statfs *sfs);
+int fstatfs(int fd, struct statfs *sfs);
+
+#endif /* !_NBCOMPAT_STATFS_H */
diff --git a/pkgtools/libnbcompat/files/poll.c b/pkgtools/libnbcompat/files/poll.c
new file mode 100644
index 00000000000..3a3e63370c3
--- /dev/null
+++ b/pkgtools/libnbcompat/files/poll.c
@@ -0,0 +1,97 @@
+/* $NetBSD: poll.c,v 1.1 2003/09/03 13:35:48 jlam Exp $ */
+
+/*-
+ * Copyright (c) 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles Blundell.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "nbcompat.h"
+
+int
+poll(struct pollfd *p, nfds_t nfds, int timout)
+{
+ fd_set read, write, except;
+ struct timeval tv;
+ nfds_t i;
+ int highfd, rval;
+
+ /*
+ * select cannot tell us much wrt POLL*BAND, POLLPRI, POLLHUP or
+ * POLLNVAL.
+ */
+ FD_ZERO(&read);
+ FD_ZERO(&write);
+ FD_ZERO(&except);
+
+ highfd = -1;
+ for (i = 0; i < nfds; i++) {
+ if (p[i].fd < 0)
+ continue;
+ if (p[i].fd >= FD_SETSIZE) {
+ errno = EINVAL;
+ return -1;
+ }
+ if (p[i].fd > highfd)
+ highfd = p[i].fd;
+
+ if (p[i].events & (POLLIN|POLLRDNORM|POLLRDBAND|POLLPRI))
+ FD_SET(p[i].fd, &read);
+ if (p[i].events & (POLLOUT|POLLWRNORM|POLLWRBAND))
+ FD_SET(p[i].fd, &write);
+ FD_SET(p[i].fd, &except);
+ }
+
+ tv.tv_sec = timout / 1000;
+ tv.tv_usec = (timout % 1000) * 1000;
+
+ rval = select(highfd + 1, &read, &write, &except,
+ timout == -1 ? NULL : &tv);
+ if (rval <= 0)
+ return rval;
+
+ rval = 0;
+ for (i = 0; i < nfds; i++) {
+ p[i].revents = 0;
+ if (FD_ISSET(p[i].fd, &read))
+ p[i].revents |= POLLIN|POLLRDNORM|POLLRDBAND|POLLPRI;
+ if (FD_ISSET(p[i].fd, &write))
+ p[i].revents |= POLLOUT|POLLWRNORM|POLLWRBAND;
+ if (FD_ISSET(p[i].fd, &except))
+ p[i].revents |= POLLERR;
+ /* XXX: POLLHUP/POLLNVAL? */
+ if (p[i].revents != 0)
+ rval++;
+ }
+ return rval;
+}
diff --git a/pkgtools/libnbcompat/files/vis.h b/pkgtools/libnbcompat/files/vis.h
deleted file mode 100644
index 91100f4d8b2..00000000000
--- a/pkgtools/libnbcompat/files/vis.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* $NetBSD: vis.h,v 1.1.1.1 2003/03/31 05:03:07 grant Exp $ */
-
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)vis.h 8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _VIS_H_
-#define _VIS_H_
-
-/*
- * to select alternate encoding format
- */
-#define VIS_OCTAL 0x01 /* use octal \ddd format */
-#define VIS_CSTYLE 0x02 /* use \[nrft0..] where appropiate */
-
-/*
- * to alter set of characters encoded (default is to encode all
- * non-graphic except space, tab, and newline).
- */
-#define VIS_SP 0x04 /* also encode space */
-#define VIS_TAB 0x08 /* also encode tab */
-#define VIS_NL 0x10 /* also encode newline */
-#define VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL)
-#define VIS_SAFE 0x20 /* only encode "unsafe" characters */
-
-/*
- * other
- */
-#define VIS_NOSLASH 0x40 /* inhibit printing '\' */
-#define VIS_HTTPSTYLE 0x80 /* http-style escape % HEX HEX */
-
-/*
- * unvis return codes
- */
-#define UNVIS_VALID 1 /* character valid */
-#define UNVIS_VALIDPUSH 2 /* character valid, push back passed char */
-#define UNVIS_NOCHAR 3 /* valid sequence, no character produced */
-#define UNVIS_SYNBAD -1 /* unrecognized escape sequence */
-#define UNVIS_ERROR -2 /* decoder in unknown state (unrecoverable) */
-
-/*
- * unvis flags
- */
-#define UNVIS_END 1 /* no more characters */
-
-#ifndef _DIAGASSERT
-#define _DIAGASSERT(e)
-#endif
-
-#if HAVE_SYS_CDEFS_H
-#include <sys/cdefs.h>
-#endif
-
-#ifndef __BEGIN_DECLS
-#define __BEGIN_DECLS
-#define __END_DECLS
-#endif
-
-__BEGIN_DECLS
-char *vis (char *, int, int, int);
-char *svis (char *, int, int, int, const char *);
-int strvis (char *, const char *, int);
-int strsvis (char *, const char *, int, const char *);
-int strvisx (char *, const char *, size_t, int);
-int strsvisx (char *, const char *, size_t, int, const char *);
-int strunvis (char *, const char *);
-int strunvisx (char *, const char *, int);
-#if defined(__LIBC12_SOURCE__) || !defined(__NetBSD__)
-int unvis (char *, int, int *, int);
-int __unvis13 (char *, int, int *, int);
-#else
-int unvis (char *, int, int *, int) __RENAME(__unvis13);
-#endif
-__END_DECLS
-
-#endif /* !_VIS_H_ */