17c0019fjamie/*-
2260ba0bpfg * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3260ba0bpfg *
47c0019fjamie * Copyright (c) 2009 James Gritton.
57c0019fjamie * All rights reserved.
67c0019fjamie *
77c0019fjamie * Redistribution and use in source and binary forms, with or without
87c0019fjamie * modification, are permitted provided that the following conditions
97c0019fjamie * are met:
107c0019fjamie * 1. Redistributions of source code must retain the above copyright
117c0019fjamie *    notice, this list of conditions and the following disclaimer.
127c0019fjamie * 2. Redistributions in binary form must reproduce the above copyright
137c0019fjamie *    notice, this list of conditions and the following disclaimer in the
147c0019fjamie *    documentation and/or other materials provided with the distribution.
157c0019fjamie *
167c0019fjamie * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
177c0019fjamie * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
187c0019fjamie * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
197c0019fjamie * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
207c0019fjamie * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
217c0019fjamie * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
227c0019fjamie * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
237c0019fjamie * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
247c0019fjamie * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
257c0019fjamie * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
267c0019fjamie * SUCH DAMAGE.
277c0019fjamie *
287c0019fjamie * $FreeBSD$
297c0019fjamie */
307c0019fjamie
317c0019fjamie#ifndef _JAIL_H
327c0019fjamie#define _JAIL_H
337c0019fjamie
347c0019fjamie#define	JP_RAWVALUE	0x01
357c0019fjamie#define	JP_BOOL		0x02
367c0019fjamie#define	JP_NOBOOL	0x04
37274ea19jamie#define	JP_JAILSYS	0x08
387c0019fjamie
397c0019fjamie#define JAIL_ERRMSGLEN	1024
407c0019fjamie
417c0019fjamieextern char jail_errmsg[];
427c0019fjamie
437c0019fjamiestruct jailparam {
447c0019fjamie	char		*jp_name;
457c0019fjamie	void		*jp_value;
467c0019fjamie	size_t		 jp_valuelen;
477c0019fjamie	size_t		 jp_elemlen;
487c0019fjamie	int		 jp_ctltype;
497c0019fjamie	int		 jp_structtype;
507c0019fjamie	unsigned	 jp_flags;
517c0019fjamie};
527c0019fjamie
537c0019fjamie__BEGIN_DECLS
547c0019fjamieextern int jail_getid(const char *name);
557c0019fjamieextern char *jail_getname(int jid);
567c0019fjamieextern int jail_setv(int flags, ...);
577c0019fjamieextern int jail_getv(int flags, ...);
587c0019fjamieextern int jailparam_all(struct jailparam **jpp);
597c0019fjamieextern int jailparam_init(struct jailparam *jp, const char *name);
607c0019fjamieextern int jailparam_import(struct jailparam *jp, const char *value);
617c0019fjamieextern int jailparam_import_raw(struct jailparam *jp, void *value,
627c0019fjamie	       size_t valuelen);
637c0019fjamieextern int jailparam_set(struct jailparam *jp, unsigned njp, int flags);
647c0019fjamieextern int jailparam_get(struct jailparam *jp, unsigned njp, int flags);
657c0019fjamieextern char *jailparam_export(struct jailparam *jp);
667c0019fjamieextern void jailparam_free(struct jailparam *jp, unsigned njp);
677c0019fjamie__END_DECLS
687c0019fjamie
697c0019fjamie#endif /* _JAIL_H  */
707c0019fjamie
717c0019fjamie
72