-/* $OpenBSD: compat_dir.c,v 1.7 2013/10/31 09:53:56 pirofti Exp $ */
+/* $OpenBSD: compat_dir.c,v 1.8 2014/01/15 05:31:51 deraadt Exp $ */
/*
* Copyright (c) 2000 Constantine Sapuntzakis
#include <compat/common/compat_dir.h>
int
-readdir_with_callback(fp, off, nbytes, appendfunc, arg)
- struct file *fp;
- off_t *off;
- u_long nbytes;
- int (*appendfunc)(void *, struct dirent *);
- void *arg;
+readdir_with_callback(struct file *fp, off_t *off, u_long nbytes,
+ int (*appendfunc)(void *, struct dirent *), void *arg)
{
struct dirent *bdp;
caddr_t inp, buf;
-/* $OpenBSD: compat_util.c,v 1.10 2004/08/01 06:22:28 mickey Exp $ */
+/* $OpenBSD: compat_util.c,v 1.11 2014/01/15 05:31:51 deraadt Exp $ */
/* $NetBSD: compat_util.c,v 1.4 1996/03/14 19:31:45 christos Exp $ */
/*
* be in exists.
*/
int
-emul_find(p, sgp, prefix, path, pbuf, cflag)
- struct proc *p;
- caddr_t *sgp; /* Pointer to stackgap memory */
- const char *prefix;
- char *path;
- char **pbuf;
- int cflag;
+emul_find(struct proc *p, caddr_t *sgp, const char *prefix,
+ char *path, char **pbuf, int cflag)
{
struct nameidata nd;
struct nameidata ndroot;
goto bad;
*cp = '/';
- }
- else {
+ } else {
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, p);
if ((error = namei(&nd)) != 0)
return error;
}
-/*
- * Translate one set of flags to another, based on the entries in
- * the given table. If 'leftover' is specified, it is filled in
- * with any flags which could not be translated.
- */
-unsigned long
-emul_flags_translate(tab, in, leftover)
- const struct emul_flags_xtab *tab;
- unsigned long in;
- unsigned long *leftover;
-{
- unsigned long out;
-
- for (out = 0; tab->omask != 0; tab++) {
- if ((in & tab->omask) == tab->oval) {
- in &= ~tab->omask;
- out |= tab->nval;
- }
- }
- if (leftover != NULL)
- *leftover = in;
- return (out);
-}
-
caddr_t
-stackgap_init(e)
- struct emul *e;
+stackgap_init(struct emul *e)
{
return STACKGAPBASE;
}
void *
-stackgap_alloc(sgp, sz)
- caddr_t *sgp;
- size_t sz;
+stackgap_alloc(caddr_t *sgp, size_t sz)
{
void *n = (void *) *sgp;
caddr_t nsgp;
-/* $OpenBSD: compat_util.h,v 1.7 2002/03/14 01:26:49 millert Exp $ */
+/* $OpenBSD: compat_util.h,v 1.8 2014/01/15 05:31:51 deraadt Exp $ */
/* $NetBSD: compat_util.h,v 1.1 1995/06/24 20:16:05 christos Exp $ */
/*
#ifndef _COMPAT_UTIL_H_
#define _COMPAT_UTIL_H_
-#include <uvm/uvm_extern.h>
#include <sys/exec.h>
struct emul;
-/* struct proc; */
caddr_t stackgap_init(struct emul *);
void *stackgap_alloc(caddr_t *, size_t);
-struct emul_flags_xtab {
- unsigned long omask;
- unsigned long oval;
- unsigned long nval;
-};
-
-int emul_find(struct proc *, caddr_t *, const char *, char *,
- char **, int);
-
-unsigned long emul_flags_translate(const struct emul_flags_xtab *tab,
- unsigned long in, unsigned long *leftover);
+int emul_find(struct proc *, caddr_t *, const char *, char *, char **, int);
#define CHECK_ALT_EXIST(p, sgp, root, path) \
emul_find(p, sgp, root, path, &(path), 0)