summaryrefslogtreecommitdiffstats
path: root/compat/opensolaris
diff options
context:
space:
mode:
authorjb <jb@FreeBSD.org>2008-03-28 00:08:47 +0000
committerjb <jb@FreeBSD.org>2008-03-28 00:08:47 +0000
commit291b24b7551a7f0ab80c6cc152155e317f53be0a (patch)
tree9edd0223cc16fd15bec321b8d36de00f35487d3b /compat/opensolaris
parent5794ada908cc2e195ebcb0217b7164e3bd207e1b (diff)
downloadFreeBSD-src-291b24b7551a7f0ab80c6cc152155e317f53be0a.zip
FreeBSD-src-291b24b7551a7f0ab80c6cc152155e317f53be0a.tar.gz
Remove files that have been repo copied to their new location
in cddl-specific parts of the source tree.
Diffstat (limited to 'compat/opensolaris')
-rw-r--r--compat/opensolaris/include/alloca.h35
-rw-r--r--compat/opensolaris/include/devid.h54
-rw-r--r--compat/opensolaris/include/fcntl.h37
-rw-r--r--compat/opensolaris/include/fsshare.h35
-rw-r--r--compat/opensolaris/include/libintl.h11
-rw-r--r--compat/opensolaris/include/mnttab.h19
-rw-r--r--compat/opensolaris/include/priv.h18
-rw-r--r--compat/opensolaris/include/solaris.h8
-rw-r--r--compat/opensolaris/include/stdio.h39
-rw-r--r--compat/opensolaris/include/stdlib.h37
-rw-r--r--compat/opensolaris/include/strings.h37
-rw-r--r--compat/opensolaris/include/unistd.h39
-rw-r--r--compat/opensolaris/include/zone.h6
-rw-r--r--compat/opensolaris/lib/libumem/umem.c167
-rw-r--r--compat/opensolaris/lib/libumem/umem.h85
-rw-r--r--compat/opensolaris/misc/deviceid.c119
-rw-r--r--compat/opensolaris/misc/fsshare.c259
-rw-r--r--compat/opensolaris/misc/mkdirp.c213
-rw-r--r--compat/opensolaris/misc/mnttab.c160
-rw-r--r--compat/opensolaris/misc/zmount.c102
-rw-r--r--compat/opensolaris/misc/zone.c46
21 files changed, 0 insertions, 1526 deletions
diff --git a/compat/opensolaris/include/alloca.h b/compat/opensolaris/include/alloca.h
deleted file mode 100644
index b8433c1..0000000
--- a/compat/opensolaris/include/alloca.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2007 John Birrell <jb@freebsd.org>
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- *
- */
-
-#ifndef _COMPAT_OPENSOLARIS_ALLOCA_H_
-#define _COMPAT_OPENSOLARIS_ALLOCA_H_
-
-#include <stdlib.h>
-
-#endif
diff --git a/compat/opensolaris/include/devid.h b/compat/opensolaris/include/devid.h
deleted file mode 100644
index 6718ce2..0000000
--- a/compat/opensolaris/include/devid.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#ifndef _OPENSOLARIS_DEVID_H_
-#define _OPENSOLARIS_DEVID_H_
-
-#include <sys/param.h>
-#include <sys/disk.h>
-#include <stdlib.h>
-
-typedef struct ddi_devid {
- char devid[DISK_IDENT_SIZE];
-} ddi_devid_t;
-
-typedef struct devid_nmlist {
- char devname[MAXPATHLEN];
- dev_t dev;
-} devid_nmlist_t;
-
-int devid_str_decode(char *devidstr, ddi_devid_t *retdevid,
- char **retminor_name);
-int devid_deviceid_to_nmlist(char *search_path, ddi_devid_t devid,
- char *minor_name, devid_nmlist_t **retlist);
-void devid_str_free(char *str);
-void devid_free(ddi_devid_t devid);
-void devid_free_nmlist(devid_nmlist_t *list);
-int devid_get(int fd, ddi_devid_t *retdevid);
-int devid_get_minor_name(int fd, char **retminor_name);
-char *devid_str_encode(ddi_devid_t devid, char *minor_name);
-
-#endif /* !_OPENSOLARIS_DEVID_H_ */
diff --git a/compat/opensolaris/include/fcntl.h b/compat/opensolaris/include/fcntl.h
deleted file mode 100644
index 9b6c3f9..0000000
--- a/compat/opensolaris/include/fcntl.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2007 John Birrell <jb@freebsd.org>
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- *
- */
-
-#ifndef _COMPAT_OPENSOLARIS_FCNTL_H_
-#define _COMPAT_OPENSOLARIS_FCNTL_H_
-
-#include_next <fcntl.h>
-
-#define open64 open
-
-#endif
diff --git a/compat/opensolaris/include/fsshare.h b/compat/opensolaris/include/fsshare.h
deleted file mode 100644
index 11a8dbf0..0000000
--- a/compat/opensolaris/include/fsshare.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*-
- * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _OPENSOLARIS_FSSHARE_H_
-#define _OPENSOLARIS_FSSHARE_H_
-
-int fsshare(const char *, const char *, const char *);
-int fsunshare(const char *, const char *);
-
-#endif /* !_OPENSOLARIS_FSSHARE_H_ */
diff --git a/compat/opensolaris/include/libintl.h b/compat/opensolaris/include/libintl.h
deleted file mode 100644
index 5954344..0000000
--- a/compat/opensolaris/include/libintl.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _LIBINTL_H_
-#define _LIBINTL_H_
-
-#include <sys/cdefs.h>
-#include <stdio.h>
-
-#define textdomain(domain) 0
-#define gettext(...) (__VA_ARGS__)
-#define dgettext(domain, ...) (__VA_ARGS__)
-
-#endif /* !_SOLARIS_H_ */
diff --git a/compat/opensolaris/include/mnttab.h b/compat/opensolaris/include/mnttab.h
deleted file mode 100644
index 6e7d28c..0000000
--- a/compat/opensolaris/include/mnttab.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _OPENSOLARIS_MNTTAB_H_
-#define _OPENSOLARIS_MNTTAB_H_
-
-#include <stdio.h>
-#include <paths.h>
-
-#define MNTTAB _PATH_DEVNULL
-#define MNT_LINE_MAX 1024
-
-struct mnttab {
- char *mnt_special;
- char *mnt_mountp;
- char *mnt_fstype;
- char *mnt_mntopts;
-};
-
-int getmntany(FILE *fd, struct mnttab *mgetp, struct mnttab *mrefp);
-
-#endif /* !_OPENSOLARIS_MNTTAB_H_ */
diff --git a/compat/opensolaris/include/priv.h b/compat/opensolaris/include/priv.h
deleted file mode 100644
index 78eae1a..0000000
--- a/compat/opensolaris/include/priv.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _OPENSOLARIS_PRIV_H_
-#define _OPENSOLARIS_PRIV_H_
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <assert.h>
-
-#define PRIV_SYS_CONFIG 0
-
-static __inline int
-priv_ineffect(priv)
-{
-
- assert(priv == PRIV_SYS_CONFIG);
- return (geteuid() == 0);
-}
-
-#endif /* !_OPENSOLARIS_PRIV_H_ */
diff --git a/compat/opensolaris/include/solaris.h b/compat/opensolaris/include/solaris.h
deleted file mode 100644
index fbdd8c6..0000000
--- a/compat/opensolaris/include/solaris.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _SOLARIS_H_
-#define _SOLARIS_H_
-
-#include <sys/ccompile.h>
-
-#define dirent64 dirent
-
-#endif /* !_SOLARIS_H_ */
diff --git a/compat/opensolaris/include/stdio.h b/compat/opensolaris/include/stdio.h
deleted file mode 100644
index eba3487..0000000
--- a/compat/opensolaris/include/stdio.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2007 John Birrell <jb@freebsd.org>
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- *
- */
-
-#ifndef _COMPAT_OPENSOLARIS_STDIO_H_
-#define _COMPAT_OPENSOLARIS_STDIO_H_
-
-#include_next <stdio.h>
-
-#define ftello64 ftello
-#define lseek64 lseek
-#define fseeko64 fseeko
-
-#endif
diff --git a/compat/opensolaris/include/stdlib.h b/compat/opensolaris/include/stdlib.h
deleted file mode 100644
index 4e21ea6..0000000
--- a/compat/opensolaris/include/stdlib.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2007 John Birrell <jb@freebsd.org>
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- *
- */
-
-#ifndef _COMPAT_OPENSOLARIS_STDLIB_H_
-#define _COMPAT_OPENSOLARIS_STDLIB_H_
-
-#include_next <stdlib.h>
-
-#define getexecname getprogname
-
-#endif
diff --git a/compat/opensolaris/include/strings.h b/compat/opensolaris/include/strings.h
deleted file mode 100644
index a62bbc8..0000000
--- a/compat/opensolaris/include/strings.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2007 John Birrell <jb@freebsd.org>
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- *
- */
-
-#ifndef _COMPAT_OPENSOLARIS_STRINGS_H_
-#define _COMPAT_OPENSOLARIS_STRINGS_H_
-
-#include_next <strings.h>
-
-#include <string.h>
-
-#endif
diff --git a/compat/opensolaris/include/unistd.h b/compat/opensolaris/include/unistd.h
deleted file mode 100644
index e1a1bc8..0000000
--- a/compat/opensolaris/include/unistd.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2007 John Birrell <jb@freebsd.org>
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- *
- */
-
-#ifndef _COMPAT_OPENSOLARIS_UNISTD_H_
-#define _COMPAT_OPENSOLARIS_UNISTD_H_
-
-#include_next <unistd.h>
-
-#define fork1 fork
-#define ftruncate64 ftruncate
-#define pread64 pread
-
-#endif
diff --git a/compat/opensolaris/include/zone.h b/compat/opensolaris/include/zone.h
deleted file mode 100644
index 487f02f..0000000
--- a/compat/opensolaris/include/zone.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _ZONE_H_
-#define _ZONE_H_
-
-#include <sys/zone.h>
-
-#endif /* !_ZONE_H_ */
diff --git a/compat/opensolaris/lib/libumem/umem.c b/compat/opensolaris/lib/libumem/umem.c
deleted file mode 100644
index e9662ce..0000000
--- a/compat/opensolaris/lib/libumem/umem.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2006 Ricardo Correia. All rights reserved.
- * Use is subject to license terms.
- */
-
-#include <umem.h>
-#include <stdlib.h>
-#include <assert.h>
-
-static umem_nofail_callback_t *nofail_cb = NULL;
-
-struct umem_cache {
- umem_constructor_t *constructor;
- umem_destructor_t *destructor;
- void *callback_data;
- size_t bufsize;
-};
-
-/*
- * Simple stub for umem_alloc(). The callback isn't expected to return.
- */
-void *umem_alloc(size_t size, int flags)
-{
- assert(flags == UMEM_DEFAULT || flags == UMEM_NOFAIL);
-
- if(size == 0)
- return NULL;
-
- void *ret = malloc(size);
- if(ret == NULL) {
- if(!(flags & UMEM_NOFAIL))
- return NULL;
-
- if(nofail_cb != NULL)
- nofail_cb();
- abort();
- }
-
- return ret;
-}
-
-/*
- * Simple stub for umem_zalloc().
- */
-void *umem_zalloc(size_t size, int flags)
-{
- assert(flags == UMEM_DEFAULT || flags == UMEM_NOFAIL);
-
- if(size == 0)
- return NULL;
-
- void *ret = calloc(1, size);
- if(ret == NULL) {
- if(!(flags & UMEM_NOFAIL))
- return NULL;
-
- if(nofail_cb != NULL)
- nofail_cb();
- abort();
- }
-
- return ret;
-}
-
-/*
- * Simple stub for umem_free().
- */
-void umem_free(void *buf, size_t size)
-{
- free(buf);
-}
-
-/*
- * Simple stub for umem_nofail_callback().
- */
-void umem_nofail_callback(umem_nofail_callback_t *callback)
-{
- nofail_cb = callback;
-}
-
-/*
- * Simple stub for umem_cache_create().
- */
-umem_cache_t *umem_cache_create(char *debug_name, size_t bufsize, size_t align, umem_constructor_t *constructor, umem_destructor_t *destructor, umem_reclaim_t *reclaim, void *callback_data, void *source, int cflags)
-{
- assert(source == NULL);
-
- umem_cache_t *cache = malloc(sizeof(umem_cache_t));
- if(cache == NULL)
- return NULL;
-
- cache->constructor = constructor;
- cache->destructor = destructor;
- cache->callback_data = callback_data;
- cache->bufsize = bufsize;
-
- return cache;
-}
-
-/*
- * Simple stub for umem_cache_alloc(). The nofail callback isn't expected to return.
- */
-void *umem_cache_alloc(umem_cache_t *cache, int flags)
-{
- void *buf = malloc(cache->bufsize);
- if(buf == NULL) {
- if(!(flags & UMEM_NOFAIL))
- return NULL;
-
- if(nofail_cb != NULL)
- nofail_cb();
- abort();
- }
-
- if(cache->constructor != NULL) {
- if(cache->constructor(buf, cache->callback_data, flags) != 0) {
- free(buf);
- if(!(flags & UMEM_NOFAIL))
- return NULL;
-
- if(nofail_cb != NULL)
- nofail_cb();
- abort();
- }
- }
-
- return buf;
-}
-
-/*
- * Simple stub for umem_cache_free().
- */
-void umem_cache_free(umem_cache_t *cache, void *buffer)
-{
- if(cache->destructor != NULL)
- cache->destructor(buffer, cache->callback_data);
-
- free(buffer);
-}
-
-/*
- * Simple stub for umem_cache_destroy().
- */
-void umem_cache_destroy(umem_cache_t *cache)
-{
- free(cache);
-}
diff --git a/compat/opensolaris/lib/libumem/umem.h b/compat/opensolaris/lib/libumem/umem.h
deleted file mode 100644
index 971cde3..0000000
--- a/compat/opensolaris/lib/libumem/umem.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#ifndef _UMEM_H
-#define _UMEM_H
-
-
-
-#include <sys/types.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define UMEM_DEFAULT 0x0000 /* normal -- may fail */
-#define UMEM_NOFAIL 0x0100 /* Never fails -- may call exit(2) */
-
-#define UMEM_FLAGS 0xffff /* all settable umem flags */
-
-extern void *umem_alloc(size_t, int);
-extern void *umem_alloc_align(size_t, size_t, int);
-extern void *umem_zalloc(size_t, int);
-extern void umem_free(void *, size_t);
-extern void umem_free_align(void *, size_t);
-
-/*
- * Flags for umem_cache_create()
- */
-#define UMC_NOTOUCH 0x00010000
-#define UMC_NODEBUG 0x00020000
-#define UMC_NOMAGAZINE 0x00040000
-#define UMC_NOHASH 0x00080000
-
-struct umem_cache; /* cache structure is opaque to umem clients */
-
-typedef struct umem_cache umem_cache_t;
-typedef int umem_constructor_t(void *, void *, int);
-typedef void umem_destructor_t(void *, void *);
-typedef void umem_reclaim_t(void *);
-
-typedef int umem_nofail_callback_t(void);
-#define UMEM_CALLBACK_RETRY 0
-#define UMEM_CALLBACK_EXIT(status) (0x100 | ((status) & 0xFF))
-
-extern void umem_nofail_callback(umem_nofail_callback_t *);
-
-extern umem_cache_t *umem_cache_create(char *, size_t,
- size_t, umem_constructor_t *, umem_destructor_t *, umem_reclaim_t *,
- void *, void *, int);
-extern void umem_cache_destroy(umem_cache_t *);
-
-extern void *umem_cache_alloc(umem_cache_t *, int);
-extern void umem_cache_free(umem_cache_t *, void *);
-
-extern void umem_reap(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _UMEM_H */
diff --git a/compat/opensolaris/misc/deviceid.c b/compat/opensolaris/misc/deviceid.c
deleted file mode 100644
index f37b1d6..0000000
--- a/compat/opensolaris/misc/deviceid.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*-
- * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <libgeom.h>
-#include <devid.h>
-
-int
-devid_str_decode(char *devidstr, ddi_devid_t *retdevid, char **retminor_name)
-{
-
- if (strlcpy(retdevid->devid, devidstr, sizeof(retdevid->devid)) >=
- sizeof(retdevid->devid)) {
- return (EINVAL);
- }
- *retminor_name = strdup("");
- if (*retminor_name == NULL);
- return (ENOMEM);
- return (0);
-}
-
-int
-devid_deviceid_to_nmlist(char *search_path, ddi_devid_t devid, char *minor_name,
- devid_nmlist_t **retlist)
-{
- char path[MAXPATHLEN];
- char *dst;
-
- if (g_get_name(devid.devid, path, sizeof(path)) == -1)
- return (errno);
- *retlist = malloc(sizeof(**retlist));
- if (*retlist == NULL)
- return (ENOMEM);
- if (strlcpy((*retlist)[0].devname, path,
- sizeof((*retlist)[0].devname)) >= sizeof((*retlist)[0].devname)) {
- free(*retlist);
- return (ENAMETOOLONG);
- }
- return (0);
-}
-
-void
-devid_str_free(char *str)
-{
-
- free(str);
-}
-
-void
-devid_free(ddi_devid_t devid)
-{
- /* Do nothing. */
-}
-
-void
-devid_free_nmlist(devid_nmlist_t *list)
-{
-
- free(list);
-}
-
-int
-devid_get(int fd, ddi_devid_t *retdevid)
-{
-
- if (ioctl(fd, DIOCGIDENT, retdevid->devid) == -1)
- return (errno);
- if (retdevid->devid[0] == '\0')
- return (ENOENT);
- return (0);
-}
-
-int
-devid_get_minor_name(int fd, char **retminor_name)
-{
-
- *retminor_name = strdup("");
- if (*retminor_name == NULL)
- return (ENOMEM);
- return (0);
-}
-
-char *
-devid_str_encode(ddi_devid_t devid, char *minor_name)
-{
-
- return (strdup(devid.devid));
-}
diff --git a/compat/opensolaris/misc/fsshare.c b/compat/opensolaris/misc/fsshare.c
deleted file mode 100644
index ca82710..0000000
--- a/compat/opensolaris/misc/fsshare.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/*-
- * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <libutil.h>
-#include <assert.h>
-#include <pathnames.h> /* _PATH_MOUNTDPID */
-#include <fsshare.h>
-
-#define FILE_HEADER "# !!! DO NOT EDIT THIS FILE MANUALLY !!!\n\n"
-#define OPTSSIZE 1024
-#define MAXLINESIZE (PATH_MAX + OPTSSIZE)
-
-static void
-restart_mountd(void)
-{
- struct pidfh *pfh;
- pid_t mountdpid;
-
- pfh = pidfile_open(_PATH_MOUNTDPID, 0600, &mountdpid);
- if (pfh != NULL) {
- /* Mountd is not running. */
- pidfile_remove(pfh);
- return;
- }
- if (errno != EEXIST) {
- /* Cannot open pidfile for some reason. */
- return;
- }
- /* We have mountd(8) PID in mountdpid varible. */
- kill(mountdpid, SIGHUP);
-}
-
-/*
- * Read one line from a file. Skip comments, empty lines and a line with a
- * mountpoint specified in the 'skip' argument.
- */
-static char *
-getline(FILE *fd, const char *skip)
-{
- static char line[MAXLINESIZE];
- size_t len, skiplen;
- char *s, last;
-
- if (skip != NULL)
- skiplen = strlen(skip);
- for (;;) {
- s = fgets(line, sizeof(line), fd);
- if (s == NULL)
- return (NULL);
- /* Skip empty lines and comments. */
- if (line[0] == '\n' || line[0] == '#')
- continue;
- len = strlen(line);
- if (line[len - 1] == '\n')
- line[len - 1] = '\0';
- last = line[skiplen];
- /* Skip the given mountpoint. */
- if (skip != NULL && strncmp(skip, line, skiplen) == 0 &&
- (last == '\t' || last == ' ' || last == '\0')) {
- continue;
- }
- break;
- }
- return (line);
-}
-
-/*
- * Function translate options to a format acceptable by exports(5), eg.
- *
- * -ro -network=192.168.0.0 -mask=255.255.255.0 -maproot=0 freefall.freebsd.org 69.147.83.54
- *
- * Accepted input formats:
- *
- * ro,network=192.168.0.0,mask=255.255.255.0,maproot=0,freefall.freebsd.org
- * ro network=192.168.0.0 mask=255.255.255.0 maproot=0 freefall.freebsd.org
- * -ro,-network=192.168.0.0,-mask=255.255.255.0,-maproot=0,freefall.freebsd.org
- * -ro -network=192.168.0.0 -mask=255.255.255.0 -maproot=0 freefall.freebsd.org
- *
- * Recognized keywords:
- *
- * ro, maproot, mapall, mask, network, alldirs, public, webnfs, index, quiet
- *
- */
-static const char *known_opts[] = { "ro", "maproot", "mapall", "mask",
- "network", "alldirs", "public", "webnfs", "index", "quiet", NULL };
-static char *
-translate_opts(const char *shareopts)
-{
- static char newopts[OPTSSIZE];
- char oldopts[OPTSSIZE];
- char *o, *s = NULL;
- unsigned int i;
- size_t len;
-
- strlcpy(oldopts, shareopts, sizeof(oldopts));
- newopts[0] = '\0';
- s = oldopts;
- while ((o = strsep(&s, "-, ")) != NULL) {
- if (o[0] == '\0')
- continue;
- for (i = 0; known_opts[i] != NULL; i++) {
- len = strlen(known_opts[i]);
- if (strncmp(known_opts[i], o, len) == 0 &&
- (o[len] == '\0' || o[len] == '=')) {
- strlcat(newopts, "-", sizeof(newopts));
- break;
- }
- }
- strlcat(newopts, o, sizeof(newopts));
- strlcat(newopts, " ", sizeof(newopts));
- }
- return (newopts);
-}
-
-static int
-fsshare_main(const char *file, const char *mountpoint, const char *shareopts,
- int share)
-{
- char tmpfile[PATH_MAX];
- char *line;
- FILE *newfd, *oldfd;
- int fd, error;
-
- newfd = oldfd = NULL;
- error = 0;
-
- /*
- * Create temporary file in the same directory, so we can atomically
- * rename it.
- */
- if (strlcpy(tmpfile, file, sizeof(tmpfile)) >= sizeof(tmpfile))
- return (ENAMETOOLONG);
- if (strlcat(tmpfile, ".XXXXXXXX", sizeof(tmpfile)) >= sizeof(tmpfile))
- return (ENAMETOOLONG);
- fd = mkstemp(tmpfile);
- if (fd == -1)
- return (errno);
- /*
- * File name is random, so we don't really need file lock now, but it
- * will be needed after rename(2).
- */
- error = flock(fd, LOCK_EX);
- assert(error == 0 || (error == -1 && errno == EOPNOTSUPP));
- newfd = fdopen(fd, "r+");
- assert(newfd != NULL);
- /* Open old exports file. */
- oldfd = fopen(file, "r");
- if (oldfd == NULL) {
- if (share) {
- if (errno != ENOENT) {
- error = errno;
- goto out;
- }
- } else {
- /* If there is no exports file, ignore the error. */
- if (errno == ENOENT)
- errno = 0;
- error = errno;
- goto out;
- }
- } else {
- error = flock(fileno(oldfd), LOCK_EX);
- assert(error == 0 || (error == -1 && errno == EOPNOTSUPP));
- error = 0;
- }
-
- /* Place big, fat warning at the begining of the file. */
- fprintf(newfd, "%s", FILE_HEADER);
- while (oldfd != NULL && (line = getline(oldfd, mountpoint)) != NULL)
- fprintf(newfd, "%s\n", line);
- if (oldfd != NULL && ferror(oldfd) != 0) {
- error = ferror(oldfd);
- goto out;
- }
- if (ferror(newfd) != 0) {
- error = ferror(newfd);
- goto out;
- }
- if (share) {
- fprintf(newfd, "%s\t%s\n", mountpoint,
- translate_opts(shareopts));
- }
-
-out:
- if (error != 0)
- unlink(tmpfile);
- else {
- if (rename(tmpfile, file) == -1) {
- error = errno;
- unlink(tmpfile);
- } else {
- /*
- * Send SIGHUP to mountd, but unlock exports file later.
- */
- restart_mountd();
- }
- }
- if (oldfd != NULL) {
- flock(fileno(oldfd), LOCK_UN);
- fclose(oldfd);
- }
- if (newfd != NULL) {
- flock(fileno(newfd), LOCK_UN);
- fclose(newfd);
- }
- return (error);
-}
-
-/*
- * Add the given mountpoint to the given exports file.
- */
-int
-fsshare(const char *file, const char *mountpoint, const char *shareopts)
-{
-
- return (fsshare_main(file, mountpoint, shareopts, 1));
-}
-
-/*
- * Remove the given mountpoint from the given exports file.
- */
-int
-fsunshare(const char *file, const char *mountpoint)
-{
-
- return (fsshare_main(file, mountpoint, NULL, 0));
-}
diff --git a/compat/opensolaris/misc/mkdirp.c b/compat/opensolaris/misc/mkdirp.c
deleted file mode 100644
index 06cec5b..0000000
--- a/compat/opensolaris/misc/mkdirp.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
-
-/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "@(#)mkdirp.c 1.15 06/01/04 SMI"
-
-/*
- * Creates directory and it's parents if the parents do not
- * exist yet.
- *
- * Returns -1 if fails for reasons other than non-existing
- * parents.
- * Does NOT simplify pathnames with . or .. in them.
- */
-
-#include <sys/types.h>
-#include <libgen.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/stat.h>
-
-static char *simplify(const char *str);
-
-int
-mkdirp(const char *d, mode_t mode)
-{
- char *endptr, *ptr, *slash, *str;
-
- str = simplify(d);
-
- /* If space couldn't be allocated for the simplified names, return. */
-
- if (str == NULL)
- return (-1);
-
- /* Try to make the directory */
-
- if (mkdir(str, mode) == 0) {
- free(str);
- return (0);
- }
- if (errno != ENOENT) {
- free(str);
- return (-1);
- }
- endptr = strrchr(str, '\0');
- slash = strrchr(str, '/');
-
- /* Search upward for the non-existing parent */
-
- while (slash != NULL) {
-
- ptr = slash;
- *ptr = '\0';
-
- /* If reached an existing parent, break */
-
- if (access(str, F_OK) == 0)
- break;
-
- /* If non-existing parent */
-
- else {
- slash = strrchr(str, '/');
-
- /* If under / or current directory, make it. */
-
- if (slash == NULL || slash == str) {
- if (mkdir(str, mode) != 0 && errno != EEXIST) {
- free(str);
- return (-1);
- }
- break;
- }
- }
- }
-
- /* Create directories starting from upmost non-existing parent */
-
- while ((ptr = strchr(str, '\0')) != endptr) {
- *ptr = '/';
- if (mkdir(str, mode) != 0 && errno != EEXIST) {
- /*
- * If the mkdir fails because str already
- * exists (EEXIST), then str has the form
- * "existing-dir/..", and this is really
- * ok. (Remember, this loop is creating the
- * portion of the path that didn't exist)
- */
- free(str);
- return (-1);
- }
- }
- free(str);
- return (0);
-}
-
-/*
- * simplify - given a pathname, simplify that path by removing
- * duplicate contiguous slashes.
- *
- * A simplified copy of the argument is returned to the
- * caller, or NULL is returned on error.
- *
- * The caller should handle error reporting based upon the
- * returned vlaue, and should free the returned value,
- * when appropriate.
- */
-
-static char *
-simplify(const char *str)
-{
- int i;
- size_t mbPathlen; /* length of multi-byte path */
- size_t wcPathlen; /* length of wide-character path */
- wchar_t *wptr; /* scratch pointer */
- wchar_t *wcPath; /* wide-character version of the path */
- char *mbPath; /* The copy fo the path to be returned */
-
- /*
- * bail out if there is nothing there.
- */
-
- if (!str)
- return (NULL);
-
- /*
- * Get a copy of the argument.
- */
-
- if ((mbPath = strdup(str)) == NULL) {
- return (NULL);
- }
-
- /*
- * convert the multi-byte version of the path to a
- * wide-character rendering, for doing our figuring.
- */
-
- mbPathlen = strlen(mbPath);
-
- if ((wcPath = calloc(sizeof (wchar_t), mbPathlen+1)) == NULL) {
- free(mbPath);
- return (NULL);
- }
-
- if ((wcPathlen = mbstowcs(wcPath, mbPath, mbPathlen)) == (size_t)-1) {
- free(mbPath);
- free(wcPath);
- return (NULL);
- }
-
- /*
- * remove duplicate slashes first ("//../" -> "/")
- */
-
- for (wptr = wcPath, i = 0; i < wcPathlen; i++) {
- *wptr++ = wcPath[i];
-
- if (wcPath[i] == '/') {
- i++;
-
- while (wcPath[i] == '/') {
- i++;
- }
-
- i--;
- }
- }
-
- *wptr = '\0';
-
- /*
- * now convert back to the multi-byte format.
- */
-
- if (wcstombs(mbPath, wcPath, mbPathlen) == (size_t)-1) {
- free(mbPath);
- free(wcPath);
- return (NULL);
- }
-
- free(wcPath);
- return (mbPath);
-}
diff --git a/compat/opensolaris/misc/mnttab.c b/compat/opensolaris/misc/mnttab.c
deleted file mode 100644
index c1971ca..0000000
--- a/compat/opensolaris/misc/mnttab.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/*-
- * Copyright (c) 2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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.
- */
-
-/*
- * This file implements Solaris compatible getmntany() and hasmntopt()
- * functions.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/mntent.h>
-#include <sys/mnttab.h>
-#include <stdio.h>
-
-static char *
-mntopt(char **p)
-{
- char *cp = *p;
- char *retstr;
-
- while (*cp && isspace(*cp))
- cp++;
-
- retstr = cp;
- while (*cp && *cp != ',')
- cp++;
-
- if (*cp) {
- *cp = '\0';
- cp++;
- }
-
- *p = cp;
- return (retstr);
-}
-
-char *
-hasmntopt(struct mnttab *mnt, char *opt)
-{
- char tmpopts[MNT_LINE_MAX];
- char *f, *opts = tmpopts;
-
- if (mnt->mnt_mntopts == NULL)
- return (NULL);
- (void) strcpy(opts, mnt->mnt_mntopts);
- f = mntopt(&opts);
- for (; *f; f = mntopt(&opts)) {
- if (strncmp(opt, f, strlen(opt)) == 0)
- return (f - tmpopts + mnt->mnt_mntopts);
- }
- return (NULL);
-}
-
-static void
-optadd(char *mntopts, size_t size, const char *opt)
-{
-
- if (mntopts[0] != '\0')
- strlcat(mntopts, ",", size);
- strlcat(mntopts, opt, size);
-}
-
-int
-getmntany(FILE *fd __unused, struct mnttab *mgetp, struct mnttab *mrefp)
-{
- static struct statfs *sfs = NULL;
- static char mntopts[MNTMAXSTR];
- struct opt *o;
- long i, n, flags;
-
- if (sfs != NULL) {
- free(sfs);
- sfs = NULL;
- }
- mntopts[0] = '\0';
-
- n = getfsstat(NULL, 0, MNT_NOWAIT);
- if (n == -1)
- return (-1);
- n = sizeof(*sfs) * (n + 8);
- sfs = malloc(n);
- if (sfs == NULL)
- return (-1);
- n = getfsstat(sfs, n, MNT_WAIT);
- if (n == -1) {
- free(sfs);
- sfs = NULL;
- return (-1);
- }
- for (i = 0; i < n; i++) {
- if (mrefp->mnt_special != NULL &&
- strcmp(mrefp->mnt_special, sfs[i].f_mntfromname) != 0) {
- continue;
- }
- if (mrefp->mnt_mountp != NULL &&
- strcmp(mrefp->mnt_mountp, sfs[i].f_mntonname) != 0) {
- continue;
- }
- if (mrefp->mnt_fstype != NULL &&
- strcmp(mrefp->mnt_fstype, sfs[i].f_fstypename) != 0) {
- continue;
- }
- flags = sfs[i].f_flags;
-#define OPTADD(opt) optadd(mntopts, sizeof(mntopts), (opt))
- if (flags & MNT_RDONLY)
- OPTADD(MNTOPT_RO);
- else
- OPTADD(MNTOPT_RW);
- if (flags & MNT_NOSUID)
- OPTADD(MNTOPT_NOSUID);
- else
- OPTADD(MNTOPT_SETUID);
- if (flags & MNT_UPDATE)
- OPTADD(MNTOPT_REMOUNT);
- if (flags & MNT_NOATIME)
- OPTADD(MNTOPT_NOATIME);
- else
- OPTADD(MNTOPT_ATIME);
- OPTADD(MNTOPT_NOXATTR);
- if (flags & MNT_NOEXEC)
- OPTADD(MNTOPT_NOEXEC);
- else
- OPTADD(MNTOPT_EXEC);
-#undef OPTADD
- mgetp->mnt_special = sfs[i].f_mntfromname;
- mgetp->mnt_mountp = sfs[i].f_mntonname;
- mgetp->mnt_fstype = sfs[i].f_fstypename;
- mgetp->mnt_mntopts = mntopts;
- return (0);
- }
- free(sfs);
- sfs = NULL;
- return (-1);
-}
diff --git a/compat/opensolaris/misc/zmount.c b/compat/opensolaris/misc/zmount.c
deleted file mode 100644
index d80a3b3..0000000
--- a/compat/opensolaris/misc/zmount.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*-
- * Copyright (c) 2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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.
- */
-
-/*
- * This file implements Solaris compatible zmount() function.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/uio.h>
-#include <sys/mntent.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
-static void
-build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val,
- size_t len)
-{
- int i;
-
- if (*iovlen < 0)
- return;
- i = *iovlen;
- *iov = realloc(*iov, sizeof(**iov) * (i + 2));
- if (*iov == NULL) {
- *iovlen = -1;
- return;
- }
- (*iov)[i].iov_base = strdup(name);
- (*iov)[i].iov_len = strlen(name) + 1;
- i++;
- (*iov)[i].iov_base = val;
- if (len == (size_t)-1) {
- if (val != NULL)
- len = strlen(val) + 1;
- else
- len = 0;
- }
- (*iov)[i].iov_len = (int)len;
- *iovlen = ++i;
-}
-
-int
-zmount(const char *spec, const char *dir, int mflag, char *fstype,
- char *dataptr, int datalen, char *optptr, int optlen)
-{
- struct iovec *iov;
- char *optstr, *os, *p;
- int iovlen, rv;
-
- assert(spec != NULL);
- assert(dir != NULL);
- assert(mflag == 0);
- assert(fstype != NULL);
- assert(strcmp(fstype, MNTTYPE_ZFS) == 0);
- assert(dataptr == NULL);
- assert(datalen == 0);
- assert(optptr != NULL);
- assert(optlen > 0);
-
- optstr = strdup(optptr);
- assert(optptr != NULL);
-
- iov = NULL;
- iovlen = 0;
- build_iovec(&iov, &iovlen, "fstype", fstype, (size_t)-1);
- build_iovec(&iov, &iovlen, "fspath", __DECONST(char *, dir),
- (size_t)-1);
- build_iovec(&iov, &iovlen, "from", __DECONST(char *, spec), (size_t)-1);
- for (p = optstr; p != NULL; strsep(&p, ",/ "))
- build_iovec(&iov, &iovlen, p, NULL, (size_t)-1);
- rv = nmount(iov, iovlen, 0);
- free(optstr);
- return (rv);
-}
diff --git a/compat/opensolaris/misc/zone.c b/compat/opensolaris/misc/zone.c
deleted file mode 100644
index 1ce77cf..0000000
--- a/compat/opensolaris/misc/zone.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-
- * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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.
- *
- * $FreeBSD$
- */
-
-#include <stdlib.h>
-#include <assert.h>
-#include <sys/types.h>
-#include <sys/sysctl.h>
-#include <sys/zone.h>
-
-int
-getzoneid(void)
-{
- size_t size;
- int jailid;
-
- /* Information that we are in jail or not is enough for our needs. */
- size = sizeof(jailid);
- if (sysctlbyname("security.jail.jailed", &jailid, &size, NULL, 0) == -1)
- assert(!"No security.jail.jailed sysctl!");
- return (jailid);
-}
OpenPOWER on IntegriCloud