Rototill this file so that it actually compiles. It doesn't do anything

in the build still due to some #undef's in svr4.h, but if you hack around
that and add some missing entries to syscalls.master, then this file will
now compile.  The changes involved proc -> thread, using FreeBSD syscall
names instead of NetBSD, and axeing syscallarg() and retval arguments.

Approved by:	re (scottl)
This commit is contained in:
John Baldwin 2005-07-07 19:25:47 +00:00
parent 8d948cd1ec
commit 07fac65b15

View File

@ -73,9 +73,17 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD$");
#include <sys/types.h> #include "opt_sysvipc.h"
#include <sys/param.h> #include <sys/param.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/proc.h> #include <sys/proc.h>
#include <sys/sem.h>
#include <sys/shm.h>
#include <sys/syscallsubr.h>
#include <sys/sysproto.h>
#include <sys/systm.h>
#include <sys/time.h> #include <sys/time.h>
#include <compat/svr4/svr4.h> #include <compat/svr4/svr4.h>
@ -99,9 +107,9 @@ static void svr4_to_bsd_semid_ds(const struct svr4_semid_ds *,
struct semid_ds *); struct semid_ds *);
static int svr4_setsemun(caddr_t *sgp, union semun **argp, static int svr4_setsemun(caddr_t *sgp, union semun **argp,
union semun *usp); union semun *usp);
static int svr4_semop(struct proc *, void *, register_t *); static int svr4_semop(struct thread *, void *);
static int svr4_semget(struct proc *, void *, register_t *); static int svr4_semget(struct thread *, void *);
static int svr4_semctl(struct proc *, void *, register_t *); static int svr4_semctl(struct thread *, void *);
#endif #endif
#ifdef SYSVMSG #ifdef SYSVMSG
@ -109,10 +117,10 @@ static void bsd_to_svr4_msqid_ds(const struct msqid_ds *,
struct svr4_msqid_ds *); struct svr4_msqid_ds *);
static void svr4_to_bsd_msqid_ds(const struct svr4_msqid_ds *, static void svr4_to_bsd_msqid_ds(const struct svr4_msqid_ds *,
struct msqid_ds *); struct msqid_ds *);
static int svr4_msgsnd(struct proc *, void *, register_t *); static int svr4_msgsnd(struct thread *, void *);
static int svr4_msgrcv(struct proc *, void *, register_t *); static int svr4_msgrcv(struct thread *, void *);
static int svr4_msgget(struct proc *, void *, register_t *); static int svr4_msgget(struct thread *, void *);
static int svr4_msgctl(struct proc *, void *, register_t *); static int svr4_msgctl(struct thread *, void *);
#endif #endif
#ifdef SYSVSHM #ifdef SYSVSHM
@ -120,10 +128,10 @@ static void bsd_to_svr4_shmid_ds(const struct shmid_ds *,
struct svr4_shmid_ds *); struct svr4_shmid_ds *);
static void svr4_to_bsd_shmid_ds(const struct svr4_shmid_ds *, static void svr4_to_bsd_shmid_ds(const struct svr4_shmid_ds *,
struct shmid_ds *); struct shmid_ds *);
static int svr4_shmat(struct proc *, void *, register_t *); static int svr4_shmat(struct thread *, void *);
static int svr4_shmdt(struct proc *, void *, register_t *); static int svr4_shmdt(struct thread *, void *);
static int svr4_shmget(struct proc *, void *, register_t *); static int svr4_shmget(struct thread *, void *);
static int svr4_shmctl(struct proc *, void *, register_t *); static int svr4_shmctl(struct thread *, void *);
#endif #endif
#if defined(SYSVMSG) || defined(SYSVSHM) || defined(SYSVSEM) #if defined(SYSVMSG) || defined(SYSVSHM) || defined(SYSVSEM)
@ -197,22 +205,21 @@ svr4_setsemun(sgp, argp, usp)
} }
struct svr4_sys_semctl_args { struct svr4_sys_semctl_args {
syscallarg(int) what; int what;
syscallarg(int) semid; int semid;
syscallarg(int) semnum; int semnum;
syscallarg(int) cmd; int cmd;
syscallarg(union semun) arg; union semun arg;
}; };
static int static int
svr4_semctl(p, v, retval) svr4_semctl(td, v)
struct proc *p; struct thread *td;
void *v; void *v;
register_t *retval;
{ {
int error; int error;
struct svr4_sys_semctl_args *uap = v; struct svr4_sys_semctl_args *uap = v;
struct sys___semctl_args ap; struct __semctl_args ap;
struct svr4_semid_ds ss; struct svr4_semid_ds ss;
struct semid_ds bs, *bsp; struct semid_ds bs, *bsp;
caddr_t sg = stackgap_init(); caddr_t sg = stackgap_init();
@ -239,28 +246,28 @@ svr4_semctl(p, v, retval)
ap.cmd = GETVAL; ap.cmd = GETVAL;
break; break;
} }
return sys___semctl(p, &ap, retval); return __semctl(td, &ap);
case SVR4_SEM_SETVAL: case SVR4_SEM_SETVAL:
error = svr4_setsemun(&sg, &ap.arg, &uap->arg); error = svr4_setsemun(&sg, &ap.arg, &uap->arg);
if (error) if (error)
return error; return error;
ap.cmd = SETVAL; ap.cmd = SETVAL;
return sys___semctl(p, &ap, retval); return __semctl(td, &ap);
case SVR4_SEM_GETALL: case SVR4_SEM_GETALL:
error = svr4_setsemun(&sg, &ap.arg, &uap->arg); error = svr4_setsemun(&sg, &ap.arg, &uap->arg);
if (error) if (error)
return error; return error;
ap.cmd = GETVAL; ap.cmd = GETVAL;
return sys___semctl(p, &ap, retval); return __semctl(td, &ap);
case SVR4_SEM_SETALL: case SVR4_SEM_SETALL:
error = svr4_setsemun(&sg, &ap.arg, &uap->arg); error = svr4_setsemun(&sg, &ap.arg, &uap->arg);
if (error) if (error)
return error; return error;
ap.cmd = SETVAL; ap.cmd = SETVAL;
return sys___semctl(p, &ap, retval); return __semctl(td, &ap);
case SVR4_IPC_STAT: case SVR4_IPC_STAT:
ap.cmd = IPC_STAT; ap.cmd = IPC_STAT;
@ -269,7 +276,7 @@ svr4_semctl(p, v, retval)
(union semun *)&bsp); (union semun *)&bsp);
if (error) if (error)
return error; return error;
if ((error = sys___semctl(p, &ap, retval)) != 0) if ((error = __semctl(td, &ap)) != 0)
return error; return error;
error = copyin((caddr_t)bsp, (caddr_t)&bs, sizeof(bs)); error = copyin((caddr_t)bsp, (caddr_t)&bs, sizeof(bs));
if (error) if (error)
@ -291,7 +298,7 @@ svr4_semctl(p, v, retval)
error = copyout(&bs, bsp, sizeof(bs)); error = copyout(&bs, bsp, sizeof(bs));
if (error) if (error)
return error; return error;
return sys___semctl(p, &ap, retval); return __semctl(td, &ap);
case SVR4_IPC_RMID: case SVR4_IPC_RMID:
ap.cmd = IPC_RMID; ap.cmd = IPC_RMID;
@ -307,7 +314,7 @@ svr4_semctl(p, v, retval)
error = copyout(&bs, bsp, sizeof(bs)); error = copyout(&bs, bsp, sizeof(bs));
if (error) if (error)
return error; return error;
return sys___semctl(p, &ap, retval); return __semctl(td, &ap);
default: default:
return EINVAL; return EINVAL;
@ -315,69 +322,65 @@ svr4_semctl(p, v, retval)
} }
struct svr4_sys_semget_args { struct svr4_sys_semget_args {
syscallarg(int) what; int what;
syscallarg(svr4_key_t) key; svr4_key_t key;
syscallarg(int) nsems; int nsems;
syscallarg(int) semflg; int semflg;
}; };
static int static int
svr4_semget(p, v, retval) svr4_semget(td, v)
struct proc *p; struct thread *td;
void *v; void *v;
register_t *retval;
{ {
struct svr4_sys_semget_args *uap = v; struct svr4_sys_semget_args *uap = v;
struct sys_semget_args ap; struct semget_args ap;
ap.key = uap->key; ap.key = uap->key;
ap.nsems = uap->nsems; ap.nsems = uap->nsems;
ap.semflg = uap->semflg; ap.semflg = uap->semflg;
return sys_semget(p, &ap, retval); return semget(td, &ap);
} }
struct svr4_sys_semop_args { struct svr4_sys_semop_args {
syscallarg(int) what; int what;
syscallarg(int) semid; int semid;
syscallarg(struct svr4_sembuf *) sops; struct svr4_sembuf * sops;
syscallarg(u_int) nsops; u_int nsops;
}; };
static int static int
svr4_semop(p, v, retval) svr4_semop(td, v)
struct proc *p; struct thread *td;
void *v; void *v;
register_t *retval;
{ {
struct svr4_sys_semop_args *uap = v; struct svr4_sys_semop_args *uap = v;
struct sys_semop_args ap; struct semop_args ap;
ap.semid = uap->semid; ap.semid = uap->semid;
/* These are the same */ /* These are the same */
ap.sops = (struct sembuf *) uap->sops; ap.sops = (struct sembuf *) uap->sops;
ap.nsops = uap->nsops; ap.nsops = uap->nsops;
return sys_semop(p, &ap, retval); return semop(td, &ap);
} }
int int
svr4_sys_semsys(p, v, retval) svr4_sys_semsys(td, uap)
struct proc *p; struct thread *td;
void *v; struct svr4_sys_semsys_args *uap;
register_t *retval;
{ {
struct svr4_sys_semsys_args *uap = v;
DPRINTF(("svr4_semsys(%d)\n", uap->what)); DPRINTF(("svr4_semsys(%d)\n", uap->what));
switch (uap->what) { switch (uap->what) {
case SVR4_semctl: case SVR4_semctl:
return svr4_semctl(p, v, retval); return svr4_semctl(td, uap);
case SVR4_semget: case SVR4_semget:
return svr4_semget(p, v, retval); return svr4_semget(td, uap);
case SVR4_semop: case SVR4_semop:
return svr4_semop(p, v, retval); return svr4_semop(td, uap);
default: default:
return EINVAL; return EINVAL;
} }
@ -442,47 +445,45 @@ svr4_to_bsd_msqid_ds(sds, bds)
} }
struct svr4_sys_msgsnd_args { struct svr4_sys_msgsnd_args {
syscallarg(int) what; int what;
syscallarg(int) msqid; int msqid;
syscallarg(void *) msgp; void * msgp;
syscallarg(size_t) msgsz; size_t msgsz;
syscallarg(int) msgflg; int msgflg;
}; };
static int static int
svr4_msgsnd(p, v, retval) svr4_msgsnd(td, v)
struct proc *p; struct thread *td;
void *v; void *v;
register_t *retval;
{ {
struct svr4_sys_msgsnd_args *uap = v; struct svr4_sys_msgsnd_args *uap = v;
struct sys_msgsnd_args ap; struct msgsnd_args ap;
ap.msqid = uap->msqid; ap.msqid = uap->msqid;
ap.msgp = uap->msgp; ap.msgp = uap->msgp;
ap.msgsz = uap->msgsz; ap.msgsz = uap->msgsz;
ap.msgflg = uap->msgflg; ap.msgflg = uap->msgflg;
return sys_msgsnd(p, &ap, retval); return msgsnd(td, &ap);
} }
struct svr4_sys_msgrcv_args { struct svr4_sys_msgrcv_args {
syscallarg(int) what; int what;
syscallarg(int) msqid; int msqid;
syscallarg(void *) msgp; void * msgp;
syscallarg(size_t) msgsz; size_t msgsz;
syscallarg(long) msgtyp; long msgtyp;
syscallarg(int) msgflg; int msgflg;
}; };
static int static int
svr4_msgrcv(p, v, retval) svr4_msgrcv(td, v)
struct proc *p; struct thread *td;
void *v; void *v;
register_t *retval;
{ {
struct svr4_sys_msgrcv_args *uap = v; struct svr4_sys_msgrcv_args *uap = v;
struct sys_msgrcv_args ap; struct msgrcv_args ap;
ap.msqid = uap->msqid; ap.msqid = uap->msqid;
ap.msgp = uap->msgp; ap.msgp = uap->msgp;
@ -490,42 +491,40 @@ svr4_msgrcv(p, v, retval)
ap.msgtyp = uap->msgtyp; ap.msgtyp = uap->msgtyp;
ap.msgflg = uap->msgflg; ap.msgflg = uap->msgflg;
return sys_msgrcv(p, &ap, retval); return msgrcv(td, &ap);
} }
struct svr4_sys_msgget_args { struct svr4_sys_msgget_args {
syscallarg(int) what; int what;
syscallarg(svr4_key_t) key; svr4_key_t key;
syscallarg(int) msgflg; int msgflg;
}; };
static int static int
svr4_msgget(p, v, retval) svr4_msgget(td, v)
struct proc *p; struct thread *td;
void *v; void *v;
register_t *retval;
{ {
struct svr4_sys_msgget_args *uap = v; struct svr4_sys_msgget_args *uap = v;
struct sys_msgget_args ap; struct msgget_args ap;
ap.key = uap->key; ap.key = uap->key;
ap.msgflg = uap->msgflg; ap.msgflg = uap->msgflg;
return sys_msgget(p, &ap, retval); return msgget(td, &ap);
} }
struct svr4_sys_msgctl_args { struct svr4_sys_msgctl_args {
syscallarg(int) what; int what;
syscallarg(int) msqid; int msqid;
syscallarg(int) cmd; int cmd;
syscallarg(struct svr4_msqid_ds *) buf; struct svr4_msqid_ds * buf;
}; };
static int static int
svr4_msgctl(p, v, retval) svr4_msgctl(td, v)
struct proc *p; struct thread *td;
void *v; void *v;
register_t *retval;
{ {
struct svr4_sys_msgctl_args *uap = v; struct svr4_sys_msgctl_args *uap = v;
struct svr4_msqid_ds ss; struct svr4_msqid_ds ss;
@ -560,24 +559,22 @@ svr4_msgctl(p, v, retval)
} }
int int
svr4_sys_msgsys(p, v, retval) svr4_sys_msgsys(td, uap)
struct proc *p; struct thread *td;
void *v; struct svr4_sys_msgsys_args *uap;
register_t *retval;
{ {
struct svr4_sys_msgsys_args *uap = v;
DPRINTF(("svr4_msgsys(%d)\n", uap->what)); DPRINTF(("svr4_msgsys(%d)\n", uap->what));
switch (uap->what) { switch (uap->what) {
case SVR4_msgsnd: case SVR4_msgsnd:
return svr4_msgsnd(p, v, retval); return svr4_msgsnd(td, uap);
case SVR4_msgrcv: case SVR4_msgrcv:
return svr4_msgrcv(p, v, retval); return svr4_msgrcv(td, uap);
case SVR4_msgget: case SVR4_msgget:
return svr4_msgget(p, v, retval); return svr4_msgget(td, uap);
case SVR4_msgctl: case SVR4_msgctl:
return svr4_msgctl(p, v, retval); return svr4_msgctl(td, uap);
default: default:
return EINVAL; return EINVAL;
} }
@ -624,87 +621,83 @@ svr4_to_bsd_shmid_ds(sds, bds)
} }
struct svr4_sys_shmat_args { struct svr4_sys_shmat_args {
syscallarg(int) what; int what;
syscallarg(int) shmid; int shmid;
syscallarg(void *) shmaddr; void * shmaddr;
syscallarg(int) shmflg; int shmflg;
}; };
static int static int
svr4_shmat(p, v, retval) svr4_shmat(td, v)
struct proc *p; struct thread *td;
void *v; void *v;
register_t *retval;
{ {
struct svr4_sys_shmat_args *uap = v; struct svr4_sys_shmat_args *uap = v;
struct sys_shmat_args ap; struct shmat_args ap;
ap.shmid = uap->shmid; ap.shmid = uap->shmid;
ap.shmaddr = uap->shmaddr; ap.shmaddr = uap->shmaddr;
ap.shmflg = uap->shmflg; ap.shmflg = uap->shmflg;
return sys_shmat(p, &ap, retval); return shmat(td, &ap);
} }
struct svr4_sys_shmdt_args { struct svr4_sys_shmdt_args {
syscallarg(int) what; int what;
syscallarg(void *) shmaddr; void * shmaddr;
}; };
static int static int
svr4_shmdt(p, v, retval) svr4_shmdt(td, v)
struct proc *p; struct thread *td;
void *v; void *v;
register_t *retval;
{ {
struct svr4_sys_shmdt_args *uap = v; struct svr4_sys_shmdt_args *uap = v;
struct sys_shmdt_args ap; struct shmdt_args ap;
ap.shmaddr = uap->shmaddr; ap.shmaddr = uap->shmaddr;
return sys_shmdt(p, &ap, retval); return shmdt(td, &ap);
} }
struct svr4_sys_shmget_args { struct svr4_sys_shmget_args {
syscallarg(int) what; int what;
syscallarg(key_t) key; key_t key;
syscallarg(int) size; int size;
syscallarg(int) shmflg; int shmflg;
}; };
static int static int
svr4_shmget(p, v, retval) svr4_shmget(td, v)
struct proc *p; struct thread *td;
void *v; void *v;
register_t *retval;
{ {
struct svr4_sys_shmget_args *uap = v; struct svr4_sys_shmget_args *uap = v;
struct sys_shmget_args ap; struct shmget_args ap;
ap.key = uap->key; ap.key = uap->key;
ap.size = uap->size; ap.size = uap->size;
ap.shmflg = uap->shmflg; ap.shmflg = uap->shmflg;
return sys_shmget(p, &ap, retval); return shmget(td, &ap);
} }
struct svr4_sys_shmctl_args { struct svr4_sys_shmctl_args {
syscallarg(int) what; int what;
syscallarg(int) shmid; int shmid;
syscallarg(int) cmd; int cmd;
syscallarg(struct svr4_shmid_ds *) buf; struct svr4_shmid_ds * buf;
}; };
int int
svr4_shmctl(p, v, retval) svr4_shmctl(td, v)
struct proc *p; struct thread *td;
void *v; void *v;
register_t *retval;
{ {
struct svr4_sys_shmctl_args *uap = v; struct svr4_sys_shmctl_args *uap = v;
int error; int error;
caddr_t sg = stackgap_init(); caddr_t sg = stackgap_init();
struct sys_shmctl_args ap; struct shmctl_args ap;
struct shmid_ds bs; struct shmid_ds bs;
struct svr4_shmid_ds ss; struct svr4_shmid_ds ss;
@ -737,7 +730,7 @@ svr4_shmctl(p, v, retval)
switch (uap->cmd) { switch (uap->cmd) {
case SVR4_IPC_STAT: case SVR4_IPC_STAT:
ap.cmd = IPC_STAT; ap.cmd = IPC_STAT;
if ((error = sys_shmctl(p, &ap, retval)) != 0) if ((error = shmctl(td, &ap)) != 0)
return error; return error;
if (uap->buf == NULL) if (uap->buf == NULL)
return 0; return 0;
@ -749,7 +742,7 @@ svr4_shmctl(p, v, retval)
case SVR4_IPC_SET: case SVR4_IPC_SET:
ap.cmd = IPC_SET; ap.cmd = IPC_SET;
return sys_shmctl(p, &ap, retval); return shmctl(td, &ap);
case SVR4_IPC_RMID: case SVR4_IPC_RMID:
case SVR4_SHM_LOCK: case SVR4_SHM_LOCK:
@ -767,7 +760,7 @@ svr4_shmctl(p, v, retval)
default: default:
return EINVAL; return EINVAL;
} }
return sys_shmctl(p, &ap, retval); return shmctl(td, &ap);
default: default:
return EINVAL; return EINVAL;
@ -775,24 +768,22 @@ svr4_shmctl(p, v, retval)
} }
int int
svr4_sys_shmsys(p, v, retval) svr4_sys_shmsys(td, uap)
struct proc *p; struct thread *td;
void *v; struct svr4_sys_shmsys_args *uap;
register_t *retval;
{ {
struct svr4_sys_shmsys_args *uap = v;
DPRINTF(("svr4_shmsys(%d)\n", uap->what)); DPRINTF(("svr4_shmsys(%d)\n", uap->what));
switch (uap->what) { switch (uap->what) {
case SVR4_shmat: case SVR4_shmat:
return svr4_shmat(p, v, retval); return svr4_shmat(td, uap);
case SVR4_shmdt: case SVR4_shmdt:
return svr4_shmdt(p, v, retval); return svr4_shmdt(td, uap);
case SVR4_shmget: case SVR4_shmget:
return svr4_shmget(p, v, retval); return svr4_shmget(td, uap);
case SVR4_shmctl: case SVR4_shmctl:
return svr4_shmctl(p, v, retval); return svr4_shmctl(td, uap);
default: default:
return ENOSYS; return ENOSYS;
} }