Home | History | Annotate | Line # | Download | only in netbsd32
netbsd32_mqueue.c revision 1.6.18.2
      1  1.6.18.2  pgoyette /*	$NetBSD: netbsd32_mqueue.c,v 1.6.18.2 2018/09/11 05:57:15 pgoyette Exp $	*/
      2       1.1    martin 
      3       1.1    martin /*-
      4       1.1    martin  * Copyright (c) 2008 The NetBSD Foundation, Inc.
      5       1.1    martin  * All rights reserved.
      6       1.1    martin  *
      7       1.1    martin  * This code is derived from software developed for The NetBSD Foundation.
      8       1.1    martin  *
      9       1.1    martin  * Redistribution and use in source and binary forms, with or without
     10       1.1    martin  * modification, are permitted provided that the following conditions
     11       1.1    martin  * are met:
     12       1.1    martin  * 1. Redistributions of source code must retain the above copyright
     13       1.1    martin  *    notice, this list of conditions and the following disclaimer.
     14       1.1    martin  * 2. Redistributions in binary form must reproduce the above copyright
     15       1.1    martin  *    notice, this list of conditions and the following disclaimer in the
     16       1.1    martin  *    documentation and/or other materials provided with the distribution.
     17       1.1    martin  *
     18       1.1    martin  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     19       1.1    martin  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     20       1.1    martin  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     21       1.1    martin  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     22       1.1    martin  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     23       1.1    martin  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     24       1.1    martin  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     25       1.1    martin  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     26       1.1    martin  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     27       1.1    martin  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     28       1.1    martin  * POSSIBILITY OF SUCH DAMAGE.
     29       1.1    martin  */
     30       1.1    martin 
     31       1.1    martin #include <sys/cdefs.h>
     32  1.6.18.2  pgoyette __KERNEL_RCSID(0, "$NetBSD: netbsd32_mqueue.c,v 1.6.18.2 2018/09/11 05:57:15 pgoyette Exp $");
     33       1.1    martin 
     34       1.1    martin #if defined(_KERNEL_OPT)
     35       1.1    martin #include "opt_compat_netbsd.h"
     36       1.1    martin #endif
     37       1.1    martin 
     38       1.1    martin #include <sys/param.h>
     39       1.1    martin #include <sys/dirent.h>
     40       1.1    martin #include <sys/filedesc.h>
     41       1.1    martin #include <sys/fcntl.h>
     42       1.1    martin #include <sys/module.h>
     43       1.6  pgoyette #include <sys/syscallvar.h>
     44       1.1    martin 
     45       1.1    martin #include <compat/netbsd32/netbsd32.h>
     46       1.1    martin #include <compat/netbsd32/netbsd32_syscall.h>
     47       1.1    martin #include <compat/netbsd32/netbsd32_syscallargs.h>
     48       1.1    martin #include <compat/netbsd32/netbsd32_conv.h>
     49       1.1    martin 
     50       1.6  pgoyette extern struct emul emul_netbsd32;
     51       1.1    martin 
     52       1.1    martin int
     53       1.1    martin netbsd32_mq_open(struct lwp *l, const struct netbsd32_mq_open_args *uap,
     54       1.1    martin     register_t *retval)
     55       1.1    martin {
     56       1.1    martin 	/* {
     57       1.1    martin 		syscallarg(const netbsd32_charp) name;
     58       1.1    martin 		syscallarg(int) oflag;
     59       1.1    martin 		syscallarg(mode_t) mode;
     60       1.1    martin 		syscallarg(struct netbsd32_mq_attrp_t) attr;
     61       1.1    martin 	} */
     62       1.1    martin 	struct netbsd32_mq_attr attr32;
     63       1.1    martin 	struct mq_attr *attr = NULL, a;
     64       1.1    martin 	int error;
     65       1.1    martin 
     66       1.5  christos 	if ((SCARG(uap, oflag) & O_CREAT) && SCARG_P32(uap, attr) != NULL) {
     67       1.5  christos 		error = copyin(SCARG_P32(uap, attr), &attr32, sizeof(attr32));
     68       1.1    martin 		if (error)
     69       1.1    martin 			return error;
     70       1.1    martin 		netbsd32_to_mq_attr(&attr32, &a);
     71       1.1    martin 		attr = &a;
     72       1.1    martin 	}
     73       1.1    martin 
     74       1.1    martin 	return mq_handle_open(l, SCARG_P32(uap, name), SCARG(uap, oflag),
     75       1.1    martin 	    SCARG(uap, mode), attr, retval);
     76       1.1    martin }
     77       1.1    martin 
     78       1.1    martin int
     79       1.1    martin netbsd32_mq_close(struct lwp *l, const struct netbsd32_mq_close_args *uap,
     80       1.1    martin     register_t *retval)
     81       1.1    martin {
     82       1.1    martin 	/* {
     83       1.1    martin 		syscallarg(mqd_t) mqdes;
     84       1.1    martin 	} */
     85       1.1    martin 
     86       1.1    martin 	return netbsd32_close(l, (const void*)uap, retval);
     87       1.1    martin }
     88       1.1    martin 
     89       1.1    martin int
     90       1.1    martin netbsd32_mq_unlink(struct lwp *l, const struct netbsd32_mq_unlink_args *uap,
     91       1.1    martin     register_t *retval)
     92       1.1    martin {
     93       1.1    martin 	/* {
     94       1.1    martin 		syscallarg(const netbsd32_charp) name;
     95       1.1    martin 	} */
     96       1.1    martin 	struct sys_mq_unlink_args ua;
     97       1.1    martin 
     98       1.1    martin 	NETBSD32TOP_UAP(name, const char);
     99       1.1    martin 	return sys_mq_unlink(l, &ua, retval);
    100       1.1    martin }
    101       1.1    martin 
    102       1.1    martin int
    103       1.1    martin netbsd32_mq_getattr(struct lwp *l, const struct netbsd32_mq_getattr_args *uap,
    104       1.1    martin     register_t *retval)
    105       1.1    martin {
    106       1.1    martin 	/* {
    107       1.1    martin 		syscallarg(mqd_t) mqdes;
    108       1.1    martin 		syscallarg(netbsd32_mq_attrp_t) mqstat;
    109       1.1    martin 	} */
    110       1.1    martin 	struct mqueue *mq;
    111       1.1    martin 	struct mq_attr attr;
    112       1.1    martin 	struct netbsd32_mq_attr a32;
    113       1.1    martin 	int error;
    114       1.1    martin 
    115       1.1    martin 	error = mqueue_get(SCARG(uap, mqdes), 0, &mq);
    116       1.1    martin 	if (error)
    117       1.1    martin 		return error;
    118       1.1    martin 
    119       1.1    martin 	memcpy(&attr, &mq->mq_attrib, sizeof(struct mq_attr));
    120       1.1    martin 	mutex_exit(&mq->mq_mtx);
    121       1.1    martin 	fd_putfile((int)SCARG(uap, mqdes));
    122       1.1    martin 	netbsd32_from_mq_attr(&attr, &a32);
    123       1.1    martin 	return copyout(&a32, SCARG_P32(uap,mqstat), sizeof(a32));
    124       1.1    martin }
    125       1.1    martin 
    126       1.1    martin int
    127       1.1    martin netbsd32_mq_setattr(struct lwp *l, const struct netbsd32_mq_setattr_args *uap,
    128       1.1    martin     register_t *retval)
    129       1.1    martin {
    130       1.1    martin 	/* {
    131       1.1    martin 		syscallarg(mqd_t) mqdes;
    132       1.1    martin 		syscallarg(const netbsd32_mq_attrp_t) mqstat;
    133       1.1    martin 		syscallarg(netbsd32_mq_attrp_t) omqstat;
    134       1.1    martin 	} */
    135       1.1    martin 	struct mqueue *mq;
    136       1.1    martin 	struct netbsd32_mq_attr attr32;
    137       1.1    martin 	struct mq_attr attr;
    138       1.1    martin 	int error, nonblock;
    139       1.1    martin 
    140       1.1    martin 	error = copyin(SCARG_P32(uap, mqstat), &attr32, sizeof(attr32));
    141       1.1    martin 	if (error)
    142       1.1    martin 		return error;
    143       1.1    martin 	netbsd32_to_mq_attr(&attr32, &attr);
    144       1.1    martin 	nonblock = (attr.mq_flags & O_NONBLOCK);
    145       1.1    martin 
    146       1.1    martin 	error = mqueue_get(SCARG(uap, mqdes), 0, &mq);
    147       1.1    martin 	if (error)
    148       1.1    martin 		return error;
    149       1.1    martin 
    150       1.1    martin 	/* Copy the old attributes, if needed */
    151       1.1    martin 	if (SCARG_P32(uap, omqstat))
    152       1.1    martin 		memcpy(&attr, &mq->mq_attrib, sizeof(struct mq_attr));
    153       1.1    martin 
    154       1.1    martin 	/* Ignore everything, except O_NONBLOCK */
    155       1.1    martin 	if (nonblock)
    156       1.1    martin 		mq->mq_attrib.mq_flags |= O_NONBLOCK;
    157       1.1    martin 	else
    158       1.1    martin 		mq->mq_attrib.mq_flags &= ~O_NONBLOCK;
    159       1.1    martin 
    160       1.1    martin 	mutex_exit(&mq->mq_mtx);
    161       1.1    martin 	fd_putfile((int)SCARG(uap, mqdes));
    162       1.1    martin 
    163       1.1    martin 	/*
    164       1.1    martin 	 * Copy the data to the user-space.
    165       1.1    martin 	 * Note: According to POSIX, the new attributes should not be set in
    166       1.1    martin 	 * case of fail - this would be violated.
    167       1.1    martin 	 */
    168       1.1    martin 	if (SCARG_P32(uap, omqstat)) {
    169       1.1    martin 		netbsd32_from_mq_attr(&attr, &attr32);
    170       1.1    martin 		error = copyout(&attr32, SCARG_P32(uap, omqstat),
    171       1.1    martin 		    sizeof(attr32));
    172       1.1    martin 	}
    173       1.1    martin 
    174       1.1    martin 	return error;
    175       1.1    martin }
    176       1.1    martin 
    177       1.1    martin int
    178       1.1    martin netbsd32_mq_notify(struct lwp *l, const struct netbsd32_mq_notify_args *uap,
    179       1.1    martin     register_t *result)
    180       1.1    martin {
    181       1.1    martin 	/* {
    182       1.1    martin 		syscallarg(mqd_t) mqdes;
    183       1.1    martin 		syscallarg(const netbsd32_sigeventp_t) notification;
    184       1.1    martin 	} */
    185       1.1    martin 	struct mqueue *mq;
    186       1.1    martin 	struct netbsd32_sigevent sig32;
    187       1.1    martin 	int error;
    188       1.1    martin 
    189       1.1    martin 	if (SCARG_P32(uap, notification)) {
    190       1.1    martin 		/* Get the signal from user-space */
    191       1.1    martin 		error = copyin(SCARG_P32(uap, notification), &sig32,
    192       1.1    martin 		    sizeof(sig32));
    193       1.1    martin 		if (error)
    194       1.1    martin 			return error;
    195       1.1    martin 		if (sig32.sigev_notify == SIGEV_SIGNAL &&
    196       1.1    martin 		    (sig32.sigev_signo <=0 || sig32.sigev_signo >= NSIG))
    197       1.1    martin 			return EINVAL;
    198       1.1    martin 	}
    199       1.1    martin 
    200       1.1    martin 	error = mqueue_get(SCARG(uap, mqdes), 0, &mq);
    201       1.1    martin 	if (error) {
    202       1.1    martin 		return error;
    203       1.1    martin 	}
    204       1.1    martin 	if (SCARG_P32(uap, notification)) {
    205       1.1    martin 		/* Register notification: set the signal and target process */
    206       1.1    martin 		if (mq->mq_notify_proc == NULL) {
    207       1.1    martin 			netbsd32_to_sigevent(&sig32, &mq->mq_sig_notify);
    208       1.1    martin 			mq->mq_notify_proc = l->l_proc;
    209       1.1    martin 		} else {
    210       1.1    martin 			/* Fail if someone else already registered */
    211       1.1    martin 			error = EBUSY;
    212       1.1    martin 		}
    213       1.1    martin 	} else {
    214       1.1    martin 		/* Unregister the notification */
    215       1.1    martin 		mq->mq_notify_proc = NULL;
    216       1.1    martin 	}
    217       1.1    martin 	mutex_exit(&mq->mq_mtx);
    218       1.1    martin 	fd_putfile((int)SCARG(uap, mqdes));
    219       1.1    martin 
    220       1.1    martin 	return error;
    221       1.1    martin }
    222       1.1    martin 
    223       1.1    martin int
    224       1.1    martin netbsd32_mq_send(struct lwp *l, const struct netbsd32_mq_send_args *uap,
    225       1.1    martin     register_t *result)
    226       1.1    martin {
    227       1.1    martin 	/* {
    228       1.1    martin 		syscallarg(mqd_t) mqdes;
    229       1.1    martin 		syscallarg(const netbsd32_charp) msg_ptr;
    230       1.1    martin 		syscallarg(netbsd32_size_t) msg_len;
    231       1.1    martin 		syscallarg(unsigned) msg_prio;
    232       1.1    martin 	} */
    233       1.1    martin 
    234       1.1    martin 
    235       1.1    martin 	return mq_send1(SCARG(uap, mqdes), SCARG_P32(uap, msg_ptr),
    236       1.1    martin 	    SCARG(uap, msg_len), SCARG(uap, msg_prio), NULL);
    237       1.1    martin }
    238       1.1    martin 
    239       1.1    martin int
    240       1.1    martin netbsd32_mq_receive(struct lwp *l, const struct netbsd32_mq_receive_args *uap,
    241       1.1    martin     register_t *retval)
    242       1.1    martin {
    243       1.1    martin 	/* {
    244       1.1    martin 		syscallarg(mqd_t) mqdes;
    245       1.1    martin 		syscallarg(netbsd32_charp) msg_ptr;
    246       1.1    martin 		syscallarg(netbsd32_size_t) msg_len;
    247       1.1    martin 		syscallarg(netbsd32_uintp) msg_prio;
    248       1.1    martin 	} */
    249       1.1    martin 	ssize_t mlen;
    250       1.1    martin 	int error;
    251       1.1    martin 
    252       1.1    martin 	error = mq_recv1(SCARG(uap, mqdes), SCARG_P32(uap, msg_ptr),
    253       1.1    martin 	    SCARG(uap, msg_len), SCARG_P32(uap, msg_prio), NULL, &mlen);
    254       1.1    martin 	if (error == 0)
    255       1.1    martin 		*retval = mlen;
    256       1.1    martin 
    257       1.1    martin 	return error;
    258       1.1    martin }
    259       1.1    martin 
    260       1.2    martin int
    261       1.2    martin netbsd32___mq_timedsend50(struct lwp *l,
    262       1.2    martin      const struct netbsd32___mq_timedsend50_args *uap, register_t *retval)
    263       1.2    martin {
    264       1.2    martin 	/* {
    265       1.2    martin 		syscallarg(mqd_t) mqdes;
    266       1.2    martin 		syscallarg(const netbsd32_charp) msg_ptr;
    267       1.2    martin 		syscallarg(netbsd32_size_t) msg_len;
    268       1.2    martin 		syscallarg(unsigned) msg_prio;
    269       1.2    martin 		syscallarg(const netbsd32_timespecp_t) abs_timeout;
    270       1.2    martin 	} */
    271       1.2    martin 	struct timespec ts, *tsp;
    272       1.2    martin 	struct netbsd32_timespec ts32;
    273       1.2    martin 	int error;
    274       1.2    martin 
    275       1.2    martin 	/* Get and convert time value */
    276       1.2    martin 	if (SCARG_P32(uap, abs_timeout)) {
    277       1.2    martin 		error = copyin(SCARG_P32(uap, abs_timeout), &ts32,
    278       1.2    martin 		     sizeof(ts32));
    279       1.2    martin 		if (error)
    280       1.2    martin 			return error;
    281       1.2    martin 		netbsd32_to_timespec(&ts32, &ts);
    282       1.2    martin 		tsp = &ts;
    283       1.2    martin 	} else {
    284       1.2    martin 		tsp = NULL;
    285       1.2    martin 	}
    286       1.2    martin 
    287       1.2    martin 	return mq_send1(SCARG(uap, mqdes), SCARG_P32(uap, msg_ptr),
    288       1.2    martin 	    SCARG(uap, msg_len), SCARG(uap, msg_prio), tsp);
    289       1.2    martin }
    290       1.2    martin 
    291       1.2    martin int
    292       1.2    martin netbsd32___mq_timedreceive50(struct lwp *l,
    293       1.2    martin     const struct netbsd32___mq_timedreceive50_args *uap, register_t *retval)
    294       1.2    martin {
    295       1.2    martin 	/* {
    296       1.2    martin 		syscallarg(mqd_t) mqdes;
    297       1.2    martin 		syscallarg(netbsd32_charp) msg_ptr;
    298       1.2    martin 		syscallarg(netbsd32_size_t) msg_len;
    299       1.2    martin 		syscallarg(netbsd32_uintp) msg_prio;
    300       1.2    martin 		syscallarg(const netbsd32_timespecp_t) abs_timeout;
    301       1.2    martin 	} */
    302       1.2    martin 	struct timespec ts, *tsp;
    303       1.2    martin 	struct netbsd32_timespec ts32;
    304       1.2    martin 	ssize_t mlen;
    305       1.2    martin 	int error;
    306       1.2    martin 
    307       1.2    martin 	/* Get and convert time value */
    308       1.2    martin 	if (SCARG_P32(uap, abs_timeout)) {
    309       1.2    martin 		error = copyin(SCARG_P32(uap, abs_timeout), &ts32,
    310       1.2    martin 		    sizeof(ts32));
    311       1.2    martin 		if (error)
    312       1.2    martin 			return error;
    313       1.2    martin 		netbsd32_to_timespec(&ts32, &ts);
    314       1.2    martin 		tsp = &ts;
    315       1.2    martin 	} else {
    316       1.2    martin 		tsp = NULL;
    317       1.2    martin 	}
    318       1.2    martin 
    319       1.2    martin 	error = mq_recv1(SCARG(uap, mqdes), SCARG_P32(uap, msg_ptr),
    320       1.2    martin 	    SCARG(uap, msg_len), SCARG_P32(uap, msg_prio), tsp, &mlen);
    321       1.2    martin 	if (error == 0)
    322       1.2    martin 		*retval = mlen;
    323       1.2    martin 
    324       1.2    martin 	return error;
    325       1.2    martin }
    326       1.1    martin 
    327       1.6  pgoyette #ifdef COMPAT_50
    328       1.6  pgoyette 
    329       1.6  pgoyette int
    330       1.6  pgoyette compat_50_netbsd32_mq_timedsend(struct lwp *l,
    331  1.6.18.2  pgoyette     const struct compat_50_netbsd32_mq_timedsend_args *uap,
    332       1.6  pgoyette     register_t *retval)
    333       1.6  pgoyette {
    334       1.6  pgoyette 	/* {
    335       1.6  pgoyette 		syscallarg(mqd_t) mqdes;
    336       1.6  pgoyette 		syscallarg(const netbsd32_charp) msg_ptr;
    337       1.6  pgoyette 		syscallarg(netbsd32_size_t) msg_len;
    338       1.6  pgoyette 		syscallarg(unsigned) msg_prio;
    339       1.6  pgoyette 		syscallarg(const netbsd32_timespec50p_t) abs_timeout;
    340       1.6  pgoyette 	} */
    341       1.6  pgoyette 	struct timespec ts, *tsp;
    342       1.6  pgoyette 	struct netbsd32_timespec50 ts32;
    343       1.6  pgoyette 	int error;
    344       1.6  pgoyette 
    345       1.6  pgoyette 	/* Get and convert time value */
    346       1.6  pgoyette 	if (SCARG_P32(uap, abs_timeout)) {
    347       1.6  pgoyette 		error = copyin(SCARG_P32(uap, abs_timeout), &ts32,
    348       1.6  pgoyette 		     sizeof(ts32));
    349       1.6  pgoyette 		if (error)
    350       1.6  pgoyette 			return error;
    351       1.6  pgoyette 		netbsd32_to_timespec50(&ts32, &ts);
    352       1.6  pgoyette 		tsp = &ts;
    353       1.6  pgoyette 	} else {
    354       1.6  pgoyette 		tsp = NULL;
    355       1.6  pgoyette 	}
    356       1.6  pgoyette 
    357       1.6  pgoyette 	return mq_send1(SCARG(uap, mqdes), SCARG_P32(uap, msg_ptr),
    358       1.6  pgoyette 	    SCARG(uap, msg_len), SCARG(uap, msg_prio), tsp);
    359       1.6  pgoyette }
    360       1.6  pgoyette 
    361       1.6  pgoyette int
    362       1.6  pgoyette compat_50_netbsd32_mq_timedreceive(struct lwp *l,
    363  1.6.18.2  pgoyette     const struct compat_50_netbsd32_mq_timedreceive_args *uap,
    364       1.6  pgoyette     register_t *retval)
    365       1.6  pgoyette {
    366       1.6  pgoyette 	/* {
    367       1.6  pgoyette 		syscallarg(mqd_t) mqdes;
    368       1.6  pgoyette 		syscallarg(netbsd32_charp) msg_ptr;
    369       1.6  pgoyette 		syscallarg(netbsd32_size_t) msg_len;
    370       1.6  pgoyette 		syscallarg(netbsd32_uintp) msg_prio;
    371       1.6  pgoyette 		syscallarg(const netbsd32_timespec50p_t) abs_timeout;
    372       1.6  pgoyette 	} */
    373       1.6  pgoyette 	struct timespec ts, *tsp;
    374       1.6  pgoyette 	struct netbsd32_timespec50 ts32;
    375       1.6  pgoyette 	ssize_t mlen;
    376       1.6  pgoyette 	int error;
    377       1.6  pgoyette 
    378       1.6  pgoyette 	/* Get and convert time value */
    379       1.6  pgoyette 	if (SCARG_P32(uap, abs_timeout)) {
    380       1.6  pgoyette 		error = copyin(SCARG_P32(uap, abs_timeout), &ts32,
    381       1.6  pgoyette 		    sizeof(ts32));
    382       1.6  pgoyette 		if (error)
    383       1.6  pgoyette 			return error;
    384       1.6  pgoyette 		netbsd32_to_timespec50(&ts32, &ts);
    385       1.6  pgoyette 		tsp = &ts;
    386       1.6  pgoyette 	} else {
    387       1.6  pgoyette 		tsp = NULL;
    388       1.6  pgoyette 	}
    389       1.6  pgoyette 
    390       1.6  pgoyette 	error = mq_recv1(SCARG(uap, mqdes), SCARG_P32(uap, msg_ptr),
    391       1.6  pgoyette 	    SCARG(uap, msg_len), SCARG_P32(uap, msg_prio), tsp, &mlen);
    392       1.6  pgoyette 	if (error == 0)
    393       1.6  pgoyette 		*retval = mlen;
    394       1.6  pgoyette 
    395       1.6  pgoyette 	return error;
    396       1.6  pgoyette }
    397       1.6  pgoyette 
    398       1.6  pgoyette #endif /* COMPAT_50 */
    399       1.6  pgoyette 
    400       1.6  pgoyette #define _PKG_ENTRY(name)	\
    401       1.6  pgoyette 	{ NETBSD32_SYS_ ## name, 0, (sy_call_t *)name }
    402       1.6  pgoyette 
    403       1.6  pgoyette static const struct syscall_package compat_mqueue_syscalls[] = {
    404       1.6  pgoyette 	_PKG_ENTRY(netbsd32_mq_open),
    405       1.6  pgoyette 	_PKG_ENTRY(netbsd32_mq_close),
    406       1.6  pgoyette 	_PKG_ENTRY(netbsd32_mq_unlink),
    407       1.6  pgoyette 	_PKG_ENTRY(netbsd32_mq_getattr),
    408       1.6  pgoyette 	_PKG_ENTRY(netbsd32_mq_setattr),
    409       1.6  pgoyette 	_PKG_ENTRY(netbsd32_mq_notify),
    410       1.6  pgoyette 	_PKG_ENTRY(netbsd32_mq_send),
    411       1.6  pgoyette 	_PKG_ENTRY(netbsd32_mq_receive),
    412       1.6  pgoyette 	_PKG_ENTRY(netbsd32___mq_timedsend50),
    413       1.6  pgoyette 	_PKG_ENTRY(netbsd32___mq_timedreceive50),
    414       1.6  pgoyette #ifdef COMPAT_50
    415       1.6  pgoyette 	_PKG_ENTRY(compat_50_netbsd32_mq_timedsend),
    416       1.6  pgoyette 	_PKG_ENTRY(compat_50_netbsd32_mq_timedreceive),
    417       1.6  pgoyette #endif
    418       1.6  pgoyette 	{0, 0, NULL}
    419       1.6  pgoyette };
    420       1.6  pgoyette 
    421       1.6  pgoyette MODULE(MODULE_CLASS_EXEC, compat_netbsd32_mqueue, "mqueue,compat_netbsd32");
    422       1.6  pgoyette 
    423       1.6  pgoyette static int
    424       1.6  pgoyette compat_netbsd32_mqueue_modcmd(modcmd_t cmd, void *arg)
    425       1.6  pgoyette {
    426       1.6  pgoyette 	int error;
    427       1.6  pgoyette 
    428       1.6  pgoyette 	switch (cmd) {
    429       1.6  pgoyette 	case MODULE_CMD_INIT:
    430       1.6  pgoyette 		error = syscall_establish(&emul_netbsd32,
    431       1.6  pgoyette 		    compat_mqueue_syscalls);
    432       1.6  pgoyette 		break;
    433       1.6  pgoyette 	case MODULE_CMD_FINI:
    434       1.6  pgoyette 		error = syscall_disestablish(&emul_netbsd32,
    435       1.6  pgoyette 		    compat_mqueue_syscalls);
    436       1.6  pgoyette 		break;
    437       1.6  pgoyette 	default:
    438       1.6  pgoyette 		error = ENOTTY;
    439       1.6  pgoyette 		break;
    440       1.6  pgoyette 	}
    441       1.6  pgoyette 	return error;
    442       1.6  pgoyette }
    443