From: Ben Gras Date: Tue, 10 Dec 2013 08:57:38 +0000 (+0100) Subject: align X-Git-Tag: v3.3.0~466 X-Git-Url: http://zhaoyanbai.com/repos/%22../static/icons/zlib_tech.html?a=commitdiff_plain;h=17587738d30df71c82702ea18126b2bbf23211f5;p=minix.git align Change-Id: I70adf01fddf931a3a6931083adaa4bbe647ea6a3 --- diff --git a/drivers/uds/ioc_uds.c b/drivers/uds/ioc_uds.c index 0a49e9ad0..3ac44084d 100644 --- a/drivers/uds/ioc_uds.c +++ b/drivers/uds/ioc_uds.c @@ -69,7 +69,8 @@ do_accept(devminor_t minor, endpoint_t endpt, cp_grant_id_t grant) for (i = 0; i < NR_FDS; i++) { if (uds_fd_table[i].addr.sun_family == AF_UNIX && !strncmp(addr.sun_path, uds_fd_table[i].addr.sun_path, - UNIX_PATH_MAX) && uds_fd_table[i].listening == 1) + sizeof(uds_fd_table[i].addr.sun_path)) && + uds_fd_table[i].listening == 1) break; } @@ -167,7 +168,7 @@ do_connect(devminor_t minor, endpoint_t endpt, cp_grant_id_t grant) return rc; if ((rc = checkperms(uds_fd_table[minor].owner, addr.sun_path, - UNIX_PATH_MAX)) != OK) + sizeof(addr.sun_path))) != OK) return rc; /* @@ -182,7 +183,7 @@ do_connect(devminor_t minor, endpoint_t endpt, cp_grant_id_t grant) if (uds_fd_table[i].addr.sun_family != AF_UNIX) continue; if (strncmp(addr.sun_path, uds_fd_table[i].addr.sun_path, - UNIX_PATH_MAX)) + sizeof(uds_fd_table[i].addr.sun_path))) continue; /* Found a matching socket. */ @@ -356,14 +357,14 @@ do_bind(devminor_t minor, endpoint_t endpt, cp_grant_id_t grant) return ENOENT; if ((rc = checkperms(uds_fd_table[minor].owner, addr.sun_path, - UNIX_PATH_MAX)) != OK) + sizeof(addr.sun_path))) != OK) return rc; /* Make sure the address isn't already in use by another socket. */ for (i = 0; i < NR_FDS; i++) { if (uds_fd_table[i].addr.sun_family == AF_UNIX && !strncmp(addr.sun_path, uds_fd_table[i].addr.sun_path, - UNIX_PATH_MAX)) { + sizeof(uds_fd_table[i].addr.sun_path))) { /* Another socket is bound to this sun_path. */ return EADDRINUSE; } @@ -612,7 +613,7 @@ do_sendto(devminor_t minor, endpoint_t endpt, cp_grant_id_t grant) return EINVAL; if ((rc = checkperms(uds_fd_table[minor].owner, addr.sun_path, - UNIX_PATH_MAX)) != OK) + sizeof(addr.sun_path))) != OK) return rc; memcpy(&uds_fd_table[minor].target, &addr, sizeof(struct sockaddr_un)); @@ -826,7 +827,8 @@ do_sendmsg(devminor_t minor, endpoint_t endpt, cp_grant_id_t grant) if (uds_fd_table[i].type == SOCK_DGRAM && uds_fd_table[i].addr.sun_family == AF_UNIX && !strncmp(uds_fd_table[minor].target.sun_path, - uds_fd_table[i].addr.sun_path, UNIX_PATH_MAX)) { + uds_fd_table[i].addr.sun_path, + sizeof(uds_fd_table[i].addr.sun_path))) { peer = i; break; } diff --git a/drivers/uds/uds.c b/drivers/uds/uds.c index 9f63ab709..c56d3cef2 100644 --- a/drivers/uds/uds.c +++ b/drivers/uds/uds.c @@ -391,7 +391,8 @@ uds_perform_write(devminor_t minor, endpoint_t endpt, cp_grant_id_t grant, if (uds_fd_table[i].type == SOCK_DGRAM && uds_fd_table[i].addr.sun_family == AF_UNIX && !strncmp(uds_fd_table[minor].target.sun_path, - uds_fd_table[i].addr.sun_path, UNIX_PATH_MAX)) { + uds_fd_table[i].addr.sun_path, + sizeof(uds_fd_table[i].addr.sun_path))) { peer = i; break; } diff --git a/lib/libc/arch/arm/sys-minix/ucontext.S b/lib/libc/arch/arm/sys-minix/ucontext.S index 23e951026..c0ec79493 100644 --- a/lib/libc/arch/arm/sys-minix/ucontext.S +++ b/lib/libc/arch/arm/sys-minix/ucontext.S @@ -7,18 +7,6 @@ IMPORT(setuctx) IMPORT(resumecontext) -/* MCF_MAGIC value from */ -#define MCF_MAGIC 0xc0ffee - -/* Values from */ -#define UCF_IGNFPU 0x002 -#define UCF_IGNSIGM 0x004 - - -/* EINVAL from errno.h */ -#define EFAULT 14 -#define EINVAL 22 - /* int getcontext(ucontext_t *ucp) * Initialise the structure pointed to by ucp to the current user context * of the calling thread. */ @@ -45,9 +33,9 @@ ENTRY(getcontext) 3: /* Check flags */ ldr r1, [r0, #UC_FLAGS] /* r1 = ucp->uc_flags */ - mov r2, #(UCF_IGNFPU | UCF_IGNSIGM) - cmp r1, r2 /* is UCF_IGNFPU or UCF_IGNSIGM set? */ - beq 1f /* Both are set, skip getuctx */ + and r1, r1, #[_UC_IGNFPU|_UC_IGNSIGM] + cmp r1, #[_UC_IGNFPU|_UC_IGNSIGM] /* Allowed to ignore both? */ + beq 1f /* If so, skip getuctx */ 0: push {r0, r3} @@ -116,9 +104,9 @@ ENTRY(setcontext) 4: ldr r1, [r0, #UC_FLAGS] /* r1 = ucp->uc_flags */ - mov r2, #(UCF_IGNFPU | UCF_IGNSIGM) - cmp r1, r2 /* Are UCF_IGNFPU and UCF_IGNSIGM flags set? */ - beq 1f /* Both are set, so don't bother restoring FPU + and r1, r1, #[_UC_IGNFPU|_UC_IGNSIGM] + cmp r1, #[_UC_IGNFPU|_UC_IGNSIGM] /* Allowed to ignore both? */ + beq 1f /* Neither are set, so don't bother restoring FPU * state and signal mask */ push {r0, r3} diff --git a/lib/libc/arch/arm/sys-minix/ucontextoffsets.cf b/lib/libc/arch/arm/sys-minix/ucontextoffsets.cf index 19595bb9f..bf21f9e36 100644 --- a/lib/libc/arch/arm/sys-minix/ucontextoffsets.cf +++ b/lib/libc/arch/arm/sys-minix/ucontextoffsets.cf @@ -1,6 +1,8 @@ include include +include +include struct __ucontext member UC_FLAGS uc_flags @@ -22,4 +24,8 @@ member REG12 uc_mcontext.mc_p_reg.r12 member SPREG uc_mcontext.mc_p_reg.sp member LRREG uc_mcontext.mc_p_reg.lr member PCREG uc_mcontext.mc_p_reg.pc - +define EFAULT EFAULT +define EINVAL EINVAL +define MCF_MAGIC MCF_MAGIC +define _UC_IGNFPU _UC_IGNFPU +define _UC_IGNSIGM _UC_IGNSIGM diff --git a/lib/libc/arch/i386/sys-minix/ucontext.S b/lib/libc/arch/i386/sys-minix/ucontext.S index 48a6fff99..859b40abe 100644 --- a/lib/libc/arch/i386/sys-minix/ucontext.S +++ b/lib/libc/arch/i386/sys-minix/ucontext.S @@ -7,19 +7,6 @@ IMPORT(resumecontext) .globl _C_LABEL(__errno) -/* MCF_MAGIC value from */ -#define MCF_MAGIC 0xc0ffee - -/* Values from */ -#define UCF_IGNFPU 0x002 -#define UCF_IGNSIGM 0x004 - - -/* EINVAL from errno.h */ -#define EFAULT 14 -#define EINVAL 22 - - /* int getcontext(ucontext_t *ucp) * Initialise the structure pointed to by ucp to the current user context * of the calling thread. */ @@ -42,8 +29,9 @@ ENTRY(getcontext) 3: /* Check flags */ mov UC_FLAGS(%edx), %eax /* eax = ucp->uc_flags */ - xor $[UCF_IGNFPU|UCF_IGNSIGM], %eax /* toggle both flags */ - jz 5f /* Both were set, skip getuctx */ + and $[_UC_IGNFPU|_UC_IGNSIGM], %eax + cmp $[_UC_IGNFPU|_UC_IGNSIGM], %eax + jz 5f /* Ignore both, skip getuctx */ PIC_PROLOGUE push %edx call PIC_PLT(_C_LABEL(getuctx)) /* getuctx(ucp) */ @@ -101,8 +89,9 @@ ENTRY(setcontext) 4: mov UC_FLAGS(%edx), %eax /* eax = ucp->uc_flags */ - xor $[UCF_IGNFPU|UCF_IGNSIGM], %eax /* toggle both flags */ - jz 5f /* Both are set, so don't bother restoring FPU + and $[_UC_IGNFPU|_UC_IGNSIGM], %eax + cmp $[_UC_IGNFPU|_UC_IGNSIGM], %eax + jz 5f /* Ignore both, so don't bother restoring FPU * state and signal mask */ PIC_PROLOGUE diff --git a/lib/libc/arch/i386/sys-minix/ucontextoffsets.cf b/lib/libc/arch/i386/sys-minix/ucontextoffsets.cf index 6473f569a..11e1a02c7 100644 --- a/lib/libc/arch/i386/sys-minix/ucontextoffsets.cf +++ b/lib/libc/arch/i386/sys-minix/ucontextoffsets.cf @@ -1,6 +1,8 @@ include include +include +include struct __ucontext member UC_FLAGS uc_flags @@ -15,4 +17,8 @@ member CX uc_mcontext.mc_p_reg.cx member DX uc_mcontext.mc_p_reg.dx member PC uc_mcontext.mc_p_reg.pc member SP uc_mcontext.mc_p_reg.sp - +define EFAULT EFAULT +define EINVAL EINVAL +define MCF_MAGIC MCF_MAGIC +define _UC_IGNFPU _UC_IGNFPU +define _UC_IGNSIGM _UC_IGNSIGM diff --git a/lib/libc/sys-minix/_ucontext.c b/lib/libc/sys-minix/_ucontext.c index 9ce993ce7..96698c76f 100644 --- a/lib/libc/sys-minix/_ucontext.c +++ b/lib/libc/sys-minix/_ucontext.c @@ -25,13 +25,13 @@ int setuctx(const ucontext_t *ucp) return(-1); } - if (!(ucp->uc_flags & UCF_IGNSIGM)) { + if (!(ucp->uc_flags & _UC_IGNSIGM)) { /* Set signal mask */ if ((r = sigprocmask(SIG_SETMASK, &ucp->uc_sigmask, NULL)) == -1) return(r); } - if (!(ucp->uc_flags & UCF_IGNFPU)) { + if (!(ucp->uc_flags & _UC_IGNFPU)) { if ((r = setmcontext(&(ucp->uc_mcontext))) == -1) return(r); } @@ -52,13 +52,13 @@ int getuctx(ucontext_t *ucp) return(-1); } - if (!(ucp->uc_flags & UCF_IGNSIGM)) { + if (!(ucp->uc_flags & _UC_IGNSIGM)) { /* Get signal mask */ if ((r = sigprocmask(0, NULL, &ucp->uc_sigmask)) == -1) return(r); } - if (!(ucp->uc_flags & UCF_IGNFPU)) { + if (!(ucp->uc_flags & _UC_IGNFPU)) { if ((r = getmcontext(&(ucp->uc_mcontext))) != 0) return(r); } @@ -232,10 +232,10 @@ int swapcontext(ucontext_t *oucp, const ucontext_t *ucp) return(-1); } - oucp->uc_flags &= ~UCF_SWAPPED; + oucp->uc_flags &= ~_UC_SWAPPED; r = getcontext(oucp); - if ((r == 0) && !(oucp->uc_flags & UCF_SWAPPED)) { - oucp->uc_flags |= UCF_SWAPPED; + if ((r == 0) && !(oucp->uc_flags & _UC_SWAPPED)) { + oucp->uc_flags |= _UC_SWAPPED; r = setcontext(ucp); } diff --git a/lib/libc/sys-minix/recvmsg.c b/lib/libc/sys-minix/recvmsg.c index 49ee7c13a..472711a21 100644 --- a/lib/libc/sys-minix/recvmsg.c +++ b/lib/libc/sys-minix/recvmsg.c @@ -4,6 +4,9 @@ #undef NDEBUG #include +#include +#include +#include #include #include #include diff --git a/lib/libmthread/scheduler.c b/lib/libmthread/scheduler.c index 335f83669..455525241 100644 --- a/lib/libmthread/scheduler.c +++ b/lib/libmthread/scheduler.c @@ -20,7 +20,7 @@ ucontext_t *ctx; /* We're not interested in FPU state nor signals, so ignore them. * Coincidentally, this significantly speeds up performance. */ - ctx->uc_flags |= (UCF_IGNFPU | UCF_IGNSIGM); + ctx->uc_flags |= _UC_IGNSIGM | _UC_IGNFPU; return getcontext(ctx); } diff --git a/servers/vfs/path.c b/servers/vfs/path.c index 8cf11f851..a105a27bc 100644 --- a/servers/vfs/path.c +++ b/servers/vfs/path.c @@ -828,9 +828,10 @@ size_t pathlen; struct fproc *rfp; char canon_path[PATH_MAX]; struct lookup resolve; + struct sockaddr_un sun; if (isokendpt(ep, &slot) != OK) return(EINVAL); - if (pathlen < UNIX_PATH_MAX || pathlen >= PATH_MAX) return(EINVAL); + if (pathlen < sizeof(sun.sun_path) || pathlen >= PATH_MAX) return(EINVAL); rfp = &(fproc[slot]); r = sys_safecopyfrom(who_e, io_gr, (vir_bytes) 0, (vir_bytes) canon_path, diff --git a/sys/sys/ucontext.h b/sys/sys/ucontext.h index 14845962d..225d1087f 100644 --- a/sys/sys/ucontext.h +++ b/sys/sys/ucontext.h @@ -40,9 +40,9 @@ typedef struct __ucontext ucontext_t; struct __ucontext { unsigned int uc_flags; /* properties */ ucontext_t * uc_link; /* context to resume */ - mcontext_t uc_mcontext; /* machine state */ sigset_t uc_sigmask; /* signals blocked in this context */ stack_t uc_stack; /* the stack used by this context */ + mcontext_t uc_mcontext; /* machine state */ #if defined(_UC_MACHINE_PAD) long __uc_pad[_UC_MACHINE_PAD]; #endif @@ -52,16 +52,81 @@ struct __ucontext { #define _UC_UCONTEXT_ALIGN (~0) #endif -#define UCF_SWAPPED 001 /* Context has been swapped in by swapcontext(3) */ -#define UCF_IGNFPU 002 /* Ignore FPU context by get or setcontext(3) */ -#define UCF_IGNSIGM 004 /* Ignore signal mask by get or setcontext(3) */ +/* uc_flags */ +#define _UC_SIGMASK 0x01 /* valid uc_sigmask */ +#define _UC_STACK 0x02 /* valid uc_stack */ +#define _UC_CPU 0x04 /* valid GPR context in uc_mcontext */ +#define _UC_FPU 0x08 /* valid FPU context in uc_mcontext */ +#ifdef __minix +#define _UC_SWAPPED 0x10000 +#define _UC_IGNFPU 0x20000 +#define _UC_IGNSIGM 0x40000 +#endif +#define _UC_MD 0x400f0020 /* MD bits. see below */ -#define NCARGS 6 +/* + * if your port needs more MD bits, please try to choose bits from _UC_MD + * first, rather than picking random unused bits. + * + * _UC_MD details + * + * _UC_TLSBASE Context contains valid pthread private pointer + * All ports must define this MD flag + * 0x00040000 hppa, mips + * 0x00000020 alpha + * 0x00080000 all other ports + * + * _UC_SETSTACK Context uses signal stack + * 0x00020000 arm + * [undefined] alpha, powerpc and vax + * 0x00010000 other ports + * + * _UC_CLRSTACK Context does not use signal stack + * 0x00040000 arm + * [undefined] alpha, powerpc and vax + * 0x00020000 other ports + * + * _UC_POWERPC_VEC Context does not use signal stack + * 0x00010000 powerpc only + * + * _UC_POWERPC_SPE Context contains valid SPE context + * 0x00020000 powerpc only + * + * _UC_M68K_UC_USER Used by m68k machdep code, but undocumented + * 0x40000000 m68k only + * + * _UC_ARM_VFP Unused + * 0x00010000 arm only + * + * _UC_VM Context contains valid virtual 8086 context + * 0x00040000 i386, amd64 only + * + * _UC_FXSAVE Context contains FPU context in that + * is in FXSAVE format in XMM space + * 0x00000020 i386, amd64 only + */ + +#ifdef _KERNEL +struct lwp; + +#ifdef __UCONTEXT_SIZE +__CTASSERT(sizeof(ucontext_t) == __UCONTEXT_SIZE); +#endif + +void getucontext(struct lwp *, ucontext_t *); +int setucontext(struct lwp *, const ucontext_t *); +void cpu_getmcontext(struct lwp *, mcontext_t *, unsigned int *); +int cpu_setmcontext(struct lwp *, const mcontext_t *, unsigned int); +int cpu_mcontext_validate(struct lwp *, const mcontext_t *); +#endif /* _KERNEL */ #ifdef __minix __BEGIN_DECLS void resumecontext(ucontext_t *ucp); - +#ifdef __UCONTEXT_SIZE +__CTASSERT(sizeof(ucontext_t) == __UCONTEXT_SIZE); +#endif + /* These functions get and set ucontext structure through PM/kernel. They don't * manipulate the stack. */ int getuctx(ucontext_t *ucp); diff --git a/sys/sys/uio.h b/sys/sys/uio.h index 47a1656f7..8cc393d26 100644 --- a/sys/sys/uio.h +++ b/sys/sys/uio.h @@ -34,6 +34,12 @@ #ifndef _SYS_UIO_H_ #define _SYS_UIO_H_ +#ifdef _KERNEL +#ifndef __UIO_EXPOSE +#define __UIO_EXPOSE +#endif +#endif + #include #include @@ -53,6 +59,37 @@ struct iovec { }; #if defined(_NETBSD_SOURCE) +#include + +#ifndef off_t +typedef __off_t off_t; /* file offset */ +#define off_t __off_t +#endif + +enum uio_rw { UIO_READ, UIO_WRITE }; + +/* Segment flag values. */ +enum uio_seg { + UIO_USERSPACE, /* from user data space */ + UIO_SYSSPACE /* from system space */ +}; + +#ifdef __UIO_EXPOSE + +struct vmspace; + +struct uio { + struct iovec *uio_iov; /* pointer to array of iovecs */ + int uio_iovcnt; /* number of iovecs in array */ + off_t uio_offset; /* offset into file this uio corresponds to */ + size_t uio_resid; /* residual i/o count */ + enum uio_rw uio_rw; /* see above */ + struct vmspace *uio_vmspace; +}; +#define UIO_SETUP_SYSSPACE(uio) uio_setup_sysspace(uio) + +#endif /* __UIO_EXPOSE */ + /* * Limits */ @@ -60,11 +97,27 @@ struct iovec { #define UIO_MAXIOV 1024 /* max 1K of iov's */ #endif /* _NETBSD_SOURCE */ +#ifdef _KERNEL + +/* 8 on stack, more will be dynamically allocated. */ +#define UIO_SMALLIOV 8 + +void uio_setup_sysspace(struct uio *); +#endif + +#ifndef _KERNEL #include __BEGIN_DECLS +#if defined(_NETBSD_SOURCE) +ssize_t preadv(int, const struct iovec *, int, off_t); +ssize_t pwritev(int, const struct iovec *, int, off_t); +#endif /* _NETBSD_SOURCE */ ssize_t readv(int, const struct iovec *, int); ssize_t writev(int, const struct iovec *, int); __END_DECLS +#else +int ureadc(int, struct uio *); +#endif /* !_KERNEL */ #endif /* !_SYS_UIO_H_ */ diff --git a/sys/sys/un.h b/sys/sys/un.h index 537149225..0a4aee56e 100644 --- a/sys/sys/un.h +++ b/sys/sys/un.h @@ -1,3 +1,36 @@ +/* $NetBSD: un.h,v 1.46 2011/06/26 16:43:12 christos Exp $ */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * @(#)un.h 8.3 (Berkeley) 2/19/95 + */ + #ifndef _SYS_UN_H_ #define _SYS_UN_H_ @@ -10,26 +43,68 @@ typedef __sa_family_t sa_family_t; #define sa_family_t __sa_family_t #endif -#define UNIX_PATH_MAX 127 - /* * Definitions for UNIX IPC domain. */ struct sockaddr_un { - uint8_t sun_len; - sa_family_t sun_family; - char sun_path[UNIX_PATH_MAX]; + uint8_t sun_len; /* total sockaddr length */ + sa_family_t sun_family; /* AF_LOCAL */ + char sun_path[104]; /* path name (gag) */ }; -#include +/* + * Socket options for UNIX IPC domain. + */ +#if defined(_NETBSD_SOURCE) +#define LOCAL_CREDS 0x0001 /* pass credentials to receiver */ +#define LOCAL_CONNWAIT 0x0002 /* connects block until accepted */ +#define LOCAL_PEEREID 0x0003 /* get peer identification */ +#endif -/* Compute the actual length of a struct sockaddr_un pointed - * to by 'unp'. sun_path must be NULL terminated. Length does - * not include the NULL byte. This is not a POSIX standard - * definition, but BSD and Linux have it, so it is here for - * compatibility. +/* + * Data automatically stored inside connect() for use by LOCAL_PEEREID */ -#define SUN_LEN(unp) \ -((size_t)((sizeof(*(unp)) - sizeof((unp)->sun_path)) + strlen((unp)->sun_path))) +struct unpcbid { + pid_t unp_pid; /* process id */ + uid_t unp_euid; /* effective user id */ + gid_t unp_egid; /* effective group id */ +}; + +#ifdef _KERNEL +struct unpcb; +struct socket; +struct sockopt; + +int uipc_usrreq(struct socket *, int, struct mbuf *, + struct mbuf *, struct mbuf *, struct lwp *); +int uipc_ctloutput(int, struct socket *, struct sockopt *); +void uipc_init (void); +kmutex_t *uipc_dgramlock (void); +kmutex_t *uipc_streamlock (void); +kmutex_t *uipc_rawlock (void); + +int unp_attach (struct socket *); +int unp_bind (struct socket *, struct mbuf *, struct lwp *); +int unp_connect (struct socket *, struct mbuf *, struct lwp *); +int unp_connect2 (struct socket *, struct socket *, int); +void unp_detach (struct unpcb *); +void unp_discard (struct file *); +void unp_disconnect (struct unpcb *); +bool unp_drop (struct unpcb *, int); +void unp_shutdown (struct unpcb *); +int unp_externalize (struct mbuf *, struct lwp *, int); +int unp_internalize (struct mbuf **); +void unp_dispose (struct mbuf *); +int unp_output (struct mbuf *, struct mbuf *, struct unpcb *, + struct lwp *); +void unp_setaddr (struct socket *, struct mbuf *, bool); +#else /* !_KERNEL */ + +/* actual length of an initialized sockaddr_un */ +#if defined(_NETBSD_SOURCE) +#define SUN_LEN(su) \ + (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path)) +#endif /* !_NetBSD_SOURCE */ +#endif /* _KERNEL */ -#endif /* _SYS_UN_H_ */ +#endif /* !_SYS_UN_H_ */ diff --git a/test/test51.c b/test/test51.c index 4cac6fc5e..40116ee6e 100644 --- a/test/test51.c +++ b/test/test51.c @@ -13,14 +13,22 @@ #include #include #include +#ifndef __arm__ #include +#else +#include +#endif #include +/* We can't use a global subtest variable reliably, because threads might + change the value when we reenter a thread (i.e., report wrong subtest + number). */ +#define err(st, en) do { subtest = st; e(en); } while(0) + void do_calcs(void); void do_child(void); void do_parent(void); -void err(int subtest, int error_no); void func1(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p, int q, int r, int s, int t, int u, int v, int w, int x, int y, int z, int aa, int bb); @@ -313,12 +321,3 @@ int main(void) return(-1); } -/* We can't use a global subtest variable reliably, because threads might - change the value when we reenter a thread (i.e., report wrong subtest - number). */ -void err(int sub, int error_no) -{ - subtest = sub; - e(error_no); -} - diff --git a/test/tvnd.c b/test/tvnd.c index 7ac318778..f868800ba 100644 --- a/test/tvnd.c +++ b/test/tvnd.c @@ -5,6 +5,7 @@ #include #include #include +#include /* * For now, just test the most dreaded case: the driver being told to use the