source: rtems/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h @ abef0f6

4.104.114.84.95
Last change on this file since abef0f6 was abef0f6, checked in by Joel Sherrill <joel.sherrill@…>, on Oct 28, 2002 at 1:56:01 PM

2002-10-28 Joel Sherrill <joel@…>

  • Pass to eliminate warnings.
  • kern/uipc_mbuf.c: Conditional SYSINIT() usage on rtems. Fix return statement without a value.
  • lib/ftpfs.c: read and write filesystem routines return ssize_t.
  • lib/syslog.c: Add include of <string.h> to eliminate warning.
  • lib/tftpDriver.c: read and write filesystem routines return ssize_t.
  • libc/gethostbydns.c: Prototype abort().
  • libc/inet_ntoa.c: Prototype strcpy().
  • libc/rcmd.c: Add include of <sys/select.h>
  • net/if_loop.c: Turn token at end of endif to comment.
  • net/rtsock.c, nfs/bootp_subr.c: Conditional SYSINIT() usage on rtems.
  • rtems/rtems_bootp.c: Add include of <rtems/rtems_bsdnet_internal.h>.
  • rtems/rtems_bsdnet_internal.h: Added prototypes for memcpy() and memset() since the BSD code tries to avoid using libc .h files since it is used to being in the kernel.
  • rtems/rtems_syscall.c: read and write filesystem routines return ssize_t.
  • Property mode set to 100644
File size: 5.1 KB
Line 
1/*
2 * Declarations to fit FreeBSD to RTEMS.
3 *
4 *******************************************************************
5 *                            WARNING                              *
6 * This file should *never* be included by any application program *
7 *******************************************************************
8 *
9 *  $Id$
10 */
11
12#ifndef _RTEMS_BSDNET_INTERNAL_H_
13#define _RTEMS_BSDNET_INTERNAL_H_
14
15#include <rtems.h>
16
17typedef unsigned int            vm_offset_t;
18typedef long long               vm_ooffset_t;
19typedef unsigned int            vm_pindex_t;
20typedef unsigned int            vm_size_t;
21
22#define _BSD_OFF_T_     rtems_signed32
23#define _BSD_PID_T_     rtems_id
24#define _BSD_VA_LIST_   char *
25
26/* make sure we get the network versions of these */
27#include <machine/types.h>
28#include <machine/param.h>
29
30#include <sys/time.h>
31/*
32struct  itimerval {
33  struct  timeval it_interval;
34  struct  timeval it_value;
35};
36*/
37struct mdproc {
38        int     md_flags;
39        int     *md_regs;
40};
41
42#define USHRT_MAX       65535
43
44/*
45 * Other RTEMS/BSD glue
46 */
47struct socket;
48extern int soconnsleep (struct socket *so);
49extern void soconnwakeup (struct socket *so);
50#define splnet()        0
51#define splimp()        0
52#define splx(_s)        do { (_s) = 0; } while(0)
53
54/* to avoid warnings */
55void *memcpy(void *dest, const void *src, size_t n);
56void *memset(void *s, int c, size_t n);
57
58#define ovbcopy(f,t,n) bcopy(f,t,n)
59#define copyout(f,t,n) (memcpy(t,f,n),0)
60#define copyin(f,t,n) (memcpy(t,f,n),0)
61
62#define random()        rtems_bsdnet_random()
63#define panic   rtems_panic
64#define suser(a,b)      0
65
66void    microtime (struct timeval *tv);
67#define hz rtems_bsdnet_ticks_per_second
68#define tick rtems_bsdnet_microseconds_per_tick
69
70#define log     rtems_bsdnet_log
71
72/*
73 * Since we can't have two sys/types.h files, we'll hack around
74 * and copy the contents of the BSD sys/types.h to here....
75 */
76#include <sys/cdefs.h>
77
78typedef u_int64_t       u_quad_t;       /* quads */
79typedef int64_t         quad_t;
80typedef quad_t *        qaddr_t;
81
82typedef void __sighandler_t __P((int));
83typedef __sighandler_t  *sig_t; /* type of pointer to a signal function */
84#define NSIG    32
85struct  sigaltstack {
86        char    *ss_sp;                 /* signal stack base */
87        int     ss_size;                /* signal stack length */
88        int     ss_flags;               /* SS_DISABLE and/or SS_ONSTACK */
89};
90
91#ifdef KERNEL
92typedef int             boolean_t;
93typedef struct vm_page  *vm_page_t;
94#endif
95
96#ifndef _POSIX_SOURCE
97/*
98 * minor() gives a cookie instead of an index since we don't want to
99 * change the meanings of bits 0-15 or waste time and space shifting
100 * bits 16-31 for devices that don't use them.
101 */
102#define major(x)        ((int)(((u_int)(x) >> 8)&0xff)) /* major number */
103#define minor(x)        ((int)((x)&0xffff00ff))         /* minor number */
104#define makedev(x,y)    ((dev_t)(((x) << 8) | (y)))     /* create dev_t */
105#endif
106
107#include <machine/endian.h>
108
109typedef quad_t          rlim_t;         /* resource limit */
110typedef u_int32_t       fixpt_t;        /* fixed point number */
111
112/*
113 * Forward structure declarations for function prototypes.  We include the
114 * common structures that cross subsystem boundaries here; others are mostly
115 * used in the same place that the structure is defined.
116 */
117struct  proc;
118struct  pgrp;
119struct  ucred;
120struct  rusage;
121struct  file;
122struct  buf;
123struct  tty;
124struct  uio;
125struct  rtems_bsdnet_ifconfig;
126
127/*
128 * Redo kernel memory allocation
129 */
130#define malloc rtems_bsdnet_malloc
131#define free rtems_bsdnet_free
132
133#define M_NOWAIT        0x0001
134void *rtems_bsdnet_malloc (unsigned long size, int type, int flags);
135void rtems_bsdnet_free (void *addr, int type);
136
137void rtems_bsdnet_semaphore_obtain (void);
138void rtems_bsdnet_semaphore_release (void);
139void rtems_bsdnet_schednetisr (int n);
140int rtems_bsdnet_parse_driver_name (const struct rtems_bsdnet_ifconfig *config, char **namep);
141
142unsigned long rtems_bsdnet_seconds_since_boot (void);
143unsigned long rtems_bsdnet_random (void);
144
145rtems_id rtems_bsdnet_newproc (
146  char  *name,
147  int   stacksize,
148  void  (*entry)(void *),
149  void  *arg
150);
151
152rtems_status_code rtems_bsdnet_event_receive (
153  rtems_event_set  event_in,
154  rtems_option     option_set,
155  rtems_interval   ticks,
156  rtems_event_set *event_out
157);
158
159/*
160 * Network configuration
161 */
162extern int rtems_bsdnet_ticks_per_second;
163extern int rtems_bsdnet_microseconds_per_tick;
164extern struct in_addr rtems_bsdnet_log_host_address;
165extern char *rtems_bsdnet_domain_name;
166extern struct in_addr rtems_bsdnet_nameserver[];
167extern int rtems_bsdnet_nameserver_count;
168
169/*
170 * Internal IOCTL command
171 */
172#define SIO_RTEMS_SHOW_STATS    _IO('i', 250)
173
174/*
175 * Some extra prototypes
176 */
177int sethostname (char *name, size_t namelen);
178void domaininit (void *);
179void ifinit (void *);
180void ipintr (void);
181void arpintr (void);
182void bootpc_init(int );
183int socket (int, int, int);
184int ioctl (int, int, ...);
185
186/*
187 * Events used by networking routines.
188 * Everything will break if the application
189 * tries to use these events or if the `sleep'
190 * events are equal to any of the NETISR * events.
191 */
192#define SBWAIT_EVENT   RTEMS_EVENT_24
193#define SOSLEEP_EVENT  RTEMS_EVENT_25
194#define NETISR_IP_EVENT                (1 << NETISR_IP)
195#define NETISR_ARP_EVENT       (1 << NETISR_ARP)
196#define NETISR_EVENTS  (NETISR_IP_EVENT|NETISR_ARP_EVENT)
197#if (SBWAIT_EVENT & SOSLEEP_EVENT & NETISR_EVENTS)
198# error "Network event conflict"
199#endif
200
201#endif /* _RTEMS_BSDNET_INTERNAL_H_ */
Note: See TracBrowser for help on using the repository browser.