OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-x86_64/] [socket32.h] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
#ifndef SOCKET32_H
2
#define SOCKET32_H 1
3
 
4
/* XXX This really belongs in some header file... -DaveM */
5
#define MAX_SOCK_ADDR   128             /* 108 for Unix domain - 
6
                                           16 for IP, 16 for IPX,
7
                                           24 for IPv6,
8
                                           about 80 for AX.25 */
9
 
10
extern struct socket *sockfd_lookup(int fd, int *err);
11
 
12
/* XXX This as well... */
13
extern __inline__ void sockfd_put(struct socket *sock)
14
{
15
        fput(sock->file);
16
}
17
 
18
struct msghdr32 {
19
        u32               msg_name;
20
        int               msg_namelen;
21
        u32               msg_iov;
22
        __kernel_size_t32 msg_iovlen;
23
        u32               msg_control;
24
        __kernel_size_t32 msg_controllen;
25
        unsigned          msg_flags;
26
};
27
 
28
struct cmsghdr32 {
29
        __kernel_size_t32 cmsg_len;
30
        int               cmsg_level;
31
        int               cmsg_type;
32
};
33
 
34
/* Bleech... */
35
#define __CMSG32_NXTHDR(ctl, len, cmsg, cmsglen) __cmsg32_nxthdr((ctl),(len),(cmsg),(cmsglen))
36
#define CMSG32_NXTHDR(mhdr, cmsg, cmsglen) cmsg32_nxthdr((mhdr), (cmsg), (cmsglen))
37
 
38
#define CMSG32_ALIGN(len) ( ((len)+sizeof(int)-1) & ~(sizeof(int)-1) )
39
 
40
#define CMSG32_DATA(cmsg)       ((void *)((char *)(cmsg) + CMSG32_ALIGN(sizeof(struct cmsghdr32))))
41
#define CMSG32_SPACE(len) (CMSG32_ALIGN(sizeof(struct cmsghdr32)) + CMSG32_ALIGN(len))
42
#define CMSG32_LEN(len) (CMSG32_ALIGN(sizeof(struct cmsghdr32)) + (len))
43
 
44
#define __CMSG32_FIRSTHDR(ctl,len) ((len) >= sizeof(struct cmsghdr32) ? \
45
                                    (struct cmsghdr32 *)(ctl) : \
46
                                    (struct cmsghdr32 *)NULL)
47
#define CMSG32_FIRSTHDR(msg)    __CMSG32_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen)
48
 
49
__inline__ struct cmsghdr32 *__cmsg32_nxthdr(void *__ctl, __kernel_size_t __size,
50
                                              struct cmsghdr32 *__cmsg, int __cmsg_len)
51
{
52
        struct cmsghdr32 * __ptr;
53
 
54
        __ptr = (struct cmsghdr32 *)(((unsigned char *) __cmsg) +
55
                                     CMSG32_ALIGN(__cmsg_len));
56
        if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size)
57
                return NULL;
58
 
59
        return __ptr;
60
}
61
 
62
__inline__ struct cmsghdr32 *cmsg32_nxthdr (struct msghdr *__msg,
63
                                            struct cmsghdr32 *__cmsg,
64
                                            int __cmsg_len)
65
{
66
        return __cmsg32_nxthdr(__msg->msg_control, __msg->msg_controllen,
67
                               __cmsg, __cmsg_len);
68
}
69
 
70
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.