mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
Fix warnings.
svn path=/trunk/; revision=16146
This commit is contained in:
parent
aa82a6a072
commit
d160d80677
15 changed files with 68 additions and 76 deletions
|
@ -129,7 +129,7 @@ void printf __P((const char *, ...));
|
|||
int __cdecl vprintf(const char *, va_list);
|
||||
|
||||
#define log bsd_log
|
||||
static int bsd_log ( int blah, const char* fmt, ... )
|
||||
static __inline int bsd_log ( int blah, const char* fmt, ... )
|
||||
{
|
||||
va_list arg;
|
||||
int i;
|
||||
|
|
|
@ -1,18 +1,16 @@
|
|||
#ifndef _OSKITFREEBSD_H
|
||||
#define _OSKITFREEBSD_H
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
#ifdef linux
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
extern void oskittcp_die(const char *file, int line);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define DbgPrint printf
|
||||
#define DbgVPrint vprintf
|
||||
#else//_MSC_VER
|
||||
#define printf DbgPrint
|
||||
#endif//_MSC_VER
|
||||
#define vprintf DbgVPrint
|
||||
#define ovbcopy(x,y,z) bcopy(x,y,z)
|
||||
void *memset( void *dest, int c, size_t count );
|
||||
#define bzero(x,y) memset(x,0,y)
|
||||
|
@ -22,14 +20,14 @@ static inline void panic ( const char* fmt, ... )
|
|||
{
|
||||
va_list arg;
|
||||
va_start(arg, fmt);
|
||||
DbgPrint ( "oskit PANIC: " );
|
||||
DbgVPrint ( fmt, arg );
|
||||
printf ( "oskit PANIC: " );
|
||||
vprintf ( fmt, arg );
|
||||
va_end(arg);
|
||||
// TODO FIXME - print stack trace...
|
||||
oskittcp_die("<unknown file>",-1);
|
||||
}
|
||||
#else//_MSC_VER
|
||||
#define panic(...) do { DbgPrint(__VA_ARGS__); \
|
||||
#define panic(...) do { printf(__VA_ARGS__); \
|
||||
oskittcp_die(__FILE__,__LINE__); } while(0)
|
||||
#endif//_MSC_VER
|
||||
#define kmem_malloc(x,y,z) malloc(y)
|
||||
|
|
|
@ -189,27 +189,8 @@ sysctl_rdstruct(oldp, oldlenp, newp, sp, len)
|
|||
return (error);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/*
|
||||
* normally, this is a builtin function in gcc
|
||||
* net/if.c doesn't seem to get it, though
|
||||
*/
|
||||
static int
|
||||
memcmp(const void *s1v, const void *s2v, size_t size)
|
||||
{
|
||||
register const char *s1 = s1v, *s2 = s2v;
|
||||
register unsigned int a, b;
|
||||
|
||||
while (size-- > 0) {
|
||||
if ((a = *s1++) != (b = *s2++))
|
||||
return (a-b);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bcmp(const void *b1, const void *b2, size_t len)
|
||||
{
|
||||
return memcmp(b1, b2, len);
|
||||
return RtlCompareMemory(b1, b2, len);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,9 @@
|
|||
* This structure is used to keep track of in_multi chains which belong to
|
||||
* deleted interface addresses.
|
||||
*/
|
||||
#ifndef __REACTOS__
|
||||
static LIST_HEAD(in_mk_type, multi_kludge) in_mk; /* XXX BSS initialization */
|
||||
#endif
|
||||
|
||||
struct multi_kludge {
|
||||
LIST_ENTRY(multi_kludge) mk_entry;
|
||||
|
|
|
@ -56,6 +56,8 @@
|
|||
#include <netinet/in_var.h>
|
||||
#include <netinet/ip_var.h>
|
||||
|
||||
#include <oskittcp.h>
|
||||
|
||||
struct in_addr zeroin_addr;
|
||||
|
||||
int
|
||||
|
@ -89,10 +91,14 @@ in_pcbbind(inp, nam)
|
|||
struct inpcbhead *head = inp->inp_pcbinfo->listhead;
|
||||
unsigned short *lastport = &inp->inp_pcbinfo->lastport;
|
||||
struct sockaddr_in *sin;
|
||||
#ifndef __REACTOS__
|
||||
struct proc *p = curproc; /* XXX */
|
||||
#endif
|
||||
u_short lport = 0;
|
||||
int wild = 0, reuseport = (so->so_options & SO_REUSEPORT);
|
||||
#ifndef __REACTOS__
|
||||
int error;
|
||||
#endif
|
||||
|
||||
OS_DbgPrint(OSK_MID_TRACE,("Called\n"));
|
||||
|
||||
|
@ -208,7 +214,9 @@ in_pcbladdr(inp, nam, plocal_sin)
|
|||
struct sockaddr_in **plocal_sin;
|
||||
{
|
||||
struct in_ifaddr *ia;
|
||||
#ifndef __REACTOS__
|
||||
struct sockaddr_in *ifaddr = 0;
|
||||
#endif
|
||||
register struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *);
|
||||
|
||||
OS_DbgPrint(OSK_MID_TRACE,("Called\n"));
|
||||
|
@ -339,7 +347,7 @@ in_pcbconnect(inp, nam)
|
|||
/*
|
||||
* Call inner routine, to assign local interface address.
|
||||
*/
|
||||
if (error = in_pcbladdr(inp, nam, &ifaddr))
|
||||
if ((error = in_pcbladdr(inp, nam, &ifaddr)))
|
||||
return(error);
|
||||
|
||||
if (in_pcblookuphash(inp->inp_pcbinfo, sin->sin_addr, sin->sin_port,
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include <oskittcp.h>
|
||||
#include <oskitdebug.h>
|
||||
#include <net/raw_cb.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -14,10 +16,6 @@
|
|||
#include <sys/socketvar.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#endif//WIN32
|
||||
|
||||
struct linker_set domain_set;
|
||||
|
||||
OSKITTCP_EVENT_HANDLERS OtcpEvent = { 0 };
|
||||
|
@ -31,6 +29,10 @@ unsigned net_imask;
|
|||
unsigned volatile ipending;
|
||||
struct timeval boottime;
|
||||
|
||||
void clock_init();
|
||||
int isprint(int c);
|
||||
int _snprintf(char * buf, size_t cnt, const char *fmt, ...);
|
||||
|
||||
void *fbsd_malloc( unsigned int bytes, ... ) {
|
||||
if( !OtcpEvent.TCPMalloc ) panic("no malloc");
|
||||
return OtcpEvent.TCPMalloc
|
||||
|
@ -51,8 +53,6 @@ void InitOskitTCP() {
|
|||
raw_init();
|
||||
OS_DbgPrint(OSK_MID_TRACE,("Route Init\n"));
|
||||
route_init();
|
||||
OS_DbgPrint(OSK_MID_TRACE,("Init fake freebsd scheduling\n"));
|
||||
init_freebsd_sched();
|
||||
OS_DbgPrint(OSK_MID_TRACE,("Init clock\n"));
|
||||
clock_init();
|
||||
OS_DbgPrint(OSK_MID_TRACE,("Init TCP\n"));
|
||||
|
@ -92,7 +92,7 @@ void OskitDumpBuffer( OSK_PCHAR Data, OSK_UINT Len )
|
|||
if ( !align )
|
||||
{
|
||||
if ( i ) DbgPrint( line );
|
||||
snprintf ( line, sizeof(line)-1, "%08x: \n", &Data[i] );
|
||||
_snprintf ( line, sizeof(line)-1, "%08x: \n", &Data[i] );
|
||||
line[sizeof(line)-1] = '\0';
|
||||
}
|
||||
|
||||
|
@ -133,12 +133,10 @@ int OskitTCPRecv( void *connection,
|
|||
OSK_UINT Len,
|
||||
OSK_UINT *OutLen,
|
||||
OSK_UINT Flags ) {
|
||||
char *output_ptr = Data;
|
||||
struct uio uio = { 0 };
|
||||
struct iovec iov = { 0 };
|
||||
int error = 0;
|
||||
int tcp_flags = 0;
|
||||
int tocopy = 0;
|
||||
|
||||
*OutLen = 0;
|
||||
|
||||
|
@ -167,33 +165,11 @@ int OskitTCPRecv( void *connection,
|
|||
return error;
|
||||
}
|
||||
|
||||
static int
|
||||
getsockaddr(namp, uaddr, len)
|
||||
/* [<][>][^][v][top][bottom][index][help] */
|
||||
struct sockaddr **namp;
|
||||
caddr_t uaddr;
|
||||
size_t len;
|
||||
{
|
||||
struct sockaddr *sa;
|
||||
int error;
|
||||
|
||||
if (len > SOCK_MAXADDRLEN)
|
||||
return ENAMETOOLONG;
|
||||
MALLOC(sa, struct sockaddr *, len, M_SONAME, M_WAITOK);
|
||||
error = copyin(uaddr, sa, len);
|
||||
if (error) {
|
||||
FREE(sa, M_SONAME);
|
||||
} else {
|
||||
*namp = sa;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int OskitTCPBind( void *socket, void *connection,
|
||||
void *nam, OSK_UINT namelen ) {
|
||||
int error = EFAULT;
|
||||
struct socket *so = socket;
|
||||
struct mbuf sabuf = { 0 };
|
||||
struct mbuf sabuf;
|
||||
struct sockaddr addr;
|
||||
|
||||
OS_DbgPrint(OSK_MID_TRACE,("Called, socket = %08x\n", socket));
|
||||
|
@ -201,6 +177,7 @@ int OskitTCPBind( void *socket, void *connection,
|
|||
if( nam )
|
||||
addr = *((struct sockaddr *)nam);
|
||||
|
||||
RtlZeroMemory(&sabuf, sizeof(sabuf));
|
||||
sabuf.m_data = (void *)&addr;
|
||||
sabuf.m_len = sizeof(addr);
|
||||
|
||||
|
@ -216,11 +193,8 @@ int OskitTCPBind( void *socket, void *connection,
|
|||
int OskitTCPConnect( void *socket, void *connection,
|
||||
void *nam, OSK_UINT namelen ) {
|
||||
struct socket *so = socket;
|
||||
struct connect_args _uap = {
|
||||
0, nam, namelen
|
||||
}, *uap = &_uap;
|
||||
int error = EFAULT, s;
|
||||
struct mbuf sabuf = { 0 };
|
||||
int error = EFAULT;
|
||||
struct mbuf sabuf;
|
||||
struct sockaddr addr;
|
||||
|
||||
OS_DbgPrint(OSK_MID_TRACE,("Called, socket = %08x\n", socket));
|
||||
|
@ -236,6 +210,7 @@ int OskitTCPConnect( void *socket, void *connection,
|
|||
if( nam )
|
||||
addr = *((struct sockaddr *)nam);
|
||||
|
||||
RtlZeroMemory(&sabuf, sizeof(sabuf));
|
||||
sabuf.m_data = (void *)&addr;
|
||||
sabuf.m_len = sizeof(addr);
|
||||
|
||||
|
@ -264,7 +239,6 @@ done:
|
|||
}
|
||||
|
||||
int OskitTCPShutdown( void *socket, int disconn_type ) {
|
||||
struct socket *so = socket;
|
||||
return soshutdown( socket, disconn_type );
|
||||
}
|
||||
|
||||
|
|
|
@ -63,8 +63,10 @@
|
|||
u_short ip_id;
|
||||
|
||||
static struct mbuf *ip_insertoptions __P((struct mbuf *, struct mbuf *, int *));
|
||||
#ifndef __REACTOS__
|
||||
static void ip_mloopback
|
||||
__P((struct ifnet *, struct mbuf *, struct sockaddr_in *));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IP output. The packet in mbuf chain m contains a skeletal IP
|
||||
|
@ -81,7 +83,9 @@ ip_output(m0, opt, ro, flags, imo)
|
|||
struct ip_moptions *imo;
|
||||
{
|
||||
register struct ip *ip, *mhip;
|
||||
#ifndef __REACTOS__
|
||||
register struct ifnet *ifp;
|
||||
#endif
|
||||
register struct mbuf *m = m0;
|
||||
register int hlen = sizeof (struct ip);
|
||||
int len, off, error = 0;
|
||||
|
@ -340,8 +344,8 @@ ip_output(m0, opt, ro, flags, imo)
|
|||
m->m_flags &= ~M_BCAST;
|
||||
#endif
|
||||
|
||||
sendit:
|
||||
#ifndef __REACTOS__
|
||||
sendit:
|
||||
/*
|
||||
* Check with the firewall...
|
||||
*/
|
||||
|
@ -382,6 +386,7 @@ sendit:
|
|||
*/
|
||||
if (ip->ip_off & IP_DF) {
|
||||
error = EMSGSIZE;
|
||||
#ifndef __REACTOS__
|
||||
#if 1
|
||||
/*
|
||||
* This case can happen if the user changed the MTU
|
||||
|
@ -395,6 +400,7 @@ sendit:
|
|||
&& (ro->ro_rt->rt_rmx.rmx_mtu > ifp->if_mtu)) {
|
||||
ro->ro_rt->rt_rmx.rmx_mtu = ifp->if_mtu;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
ipstat.ips_cantfrag++;
|
||||
goto bad;
|
||||
|
@ -509,8 +515,9 @@ sendorfree:
|
|||
ipstat.ips_fragmented++;
|
||||
}
|
||||
done:
|
||||
if (ro == &iproute && (flags & IP_ROUTETOIF) == 0 && ro->ro_rt)
|
||||
if (ro == &iproute && (flags & IP_ROUTETOIF) == 0 && ro->ro_rt) {
|
||||
RTFREE(ro->ro_rt);
|
||||
}
|
||||
|
||||
return (error);
|
||||
bad:
|
||||
|
@ -773,7 +780,7 @@ ip_pcbopts(pcbopt, m)
|
|||
struct mbuf **pcbopt;
|
||||
register struct mbuf *m;
|
||||
{
|
||||
register cnt, optlen;
|
||||
register int cnt, optlen;
|
||||
register u_char *cp;
|
||||
u_char opt;
|
||||
|
||||
|
@ -875,15 +882,19 @@ ip_setmoptions(optname, imop, m)
|
|||
struct mbuf *m;
|
||||
{
|
||||
register int error = 0;
|
||||
#ifndef __REACTOS__
|
||||
u_char loop;
|
||||
register int i;
|
||||
struct in_addr addr;
|
||||
register struct ip_mreq *mreq;
|
||||
register struct ifnet *ifp;
|
||||
#endif
|
||||
register struct ip_moptions *imo = *imop;
|
||||
#ifndef __REACTOS__
|
||||
struct route ro;
|
||||
register struct sockaddr_in *dst;
|
||||
int s;
|
||||
#endif
|
||||
|
||||
if (imo == NULL) {
|
||||
/*
|
||||
|
@ -1149,10 +1160,12 @@ ip_getmoptions(optname, imo, mp)
|
|||
register struct ip_moptions *imo;
|
||||
register struct mbuf **mp;
|
||||
{
|
||||
#ifndef __REACTOS__
|
||||
u_char *ttl;
|
||||
u_char *loop;
|
||||
struct in_addr *addr;
|
||||
struct in_ifaddr *ia;
|
||||
#endif
|
||||
|
||||
*mp = m_get(M_WAIT, MT_SOOPTS);
|
||||
|
||||
|
|
|
@ -156,7 +156,9 @@ rip_output(m, so, dst)
|
|||
{
|
||||
register struct ip *ip;
|
||||
register struct inpcb *inp = sotoinpcb(so);
|
||||
#ifndef __REACTOS__
|
||||
struct mbuf *opts;
|
||||
#endif
|
||||
int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST;
|
||||
|
||||
/*
|
||||
|
|
|
@ -365,7 +365,9 @@ ifa_ifwithroute(flags, dst, gateway)
|
|||
|
||||
#define ROUNDUP(a) (a>0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
|
||||
|
||||
#ifndef __REACTOS__
|
||||
static int rt_fixdelete(struct radix_node *, void *);
|
||||
#endif
|
||||
static int rt_fixchange(struct radix_node *, void *);
|
||||
|
||||
struct rtfc_arg {
|
||||
|
@ -385,7 +387,9 @@ rtrequest(req, dst, gateway, netmask, flags, ret_nrt)
|
|||
register struct radix_node_head *rnh;
|
||||
struct ifaddr *ifa;
|
||||
struct sockaddr *ndst;
|
||||
#ifndef __REACTOS__
|
||||
u_long prflags = 0UL;
|
||||
#endif
|
||||
#define senderr(x) { error = x ; goto bad; }
|
||||
|
||||
if ((rnh = rt_tables[dst->sa_family]) == 0)
|
||||
|
@ -561,6 +565,7 @@ bad:
|
|||
* rnh->rnh_walktree_from() above, and those that actually are children of
|
||||
* the late parent (passed in as VP here) are themselves deleted.
|
||||
*/
|
||||
#ifndef __REACTOS__
|
||||
static int
|
||||
rt_fixdelete(struct radix_node *rn, void *vp)
|
||||
{
|
||||
|
@ -574,6 +579,7 @@ rt_fixdelete(struct radix_node *rn, void *vp)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This routine is called from rt_setgate() to do the analogous thing for
|
||||
|
|
|
@ -206,8 +206,8 @@ route_output(m, so)
|
|||
case RTM_LOCK:
|
||||
if ((rnh = rt_tables[dst->sa_family]) == 0) {
|
||||
senderr(EAFNOSUPPORT);
|
||||
} else if (rt = (struct rtentry *)
|
||||
rnh->rnh_lookup(dst, netmask, rnh))
|
||||
} else if ((rt = (struct rtentry *)
|
||||
rnh->rnh_lookup(dst, netmask, rnh)))
|
||||
rt->rt_refcnt++;
|
||||
else
|
||||
senderr(ESRCH);
|
||||
|
|
|
@ -83,8 +83,10 @@ tcp_trace(act, ostate, tp, ti, req)
|
|||
struct tcpiphdr *ti;
|
||||
int req;
|
||||
{
|
||||
#ifdef TCPDEBUG
|
||||
tcp_seq seq, ack;
|
||||
int len, flags;
|
||||
#endif
|
||||
struct tcp_debug *td = &tcp_debug[tcp_debx++];
|
||||
|
||||
if (tcp_debx == TCP_NDEBUG)
|
||||
|
|
|
@ -516,7 +516,7 @@ findpcb:
|
|||
* if the segment has a CC option equal to CCrecv
|
||||
*/
|
||||
((tp->t_flags & (TF_REQ_CC|TF_RCVD_CC)) != (TF_REQ_CC|TF_RCVD_CC) ||
|
||||
(to.to_flag & TOF_CC) != 0 && to.to_cc == tp->cc_recv) &&
|
||||
((to.to_flag & TOF_CC) != 0 && to.to_cc == tp->cc_recv)) &&
|
||||
ti->ti_seq == tp->rcv_nxt &&
|
||||
tiwin && tiwin == tp->snd_wnd &&
|
||||
tp->snd_nxt == tp->snd_max) {
|
||||
|
|
|
@ -780,7 +780,7 @@ void
|
|||
tcp_setpersist(tp)
|
||||
register struct tcpcb *tp;
|
||||
{
|
||||
register t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1;
|
||||
register int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1;
|
||||
|
||||
if (tp->t_timer[TCPT_REXMT])
|
||||
panic("tcp_output REXMT");
|
||||
|
|
|
@ -101,7 +101,9 @@ m_clalloc(ncl, nowait)
|
|||
register int ncl;
|
||||
int nowait;
|
||||
{
|
||||
#ifndef __REACTOS__
|
||||
static int logged;
|
||||
#endif
|
||||
register caddr_t p;
|
||||
register int i;
|
||||
int npg;
|
||||
|
@ -456,7 +458,7 @@ m_adj(mp, req_len)
|
|||
{
|
||||
register int len = req_len;
|
||||
register struct mbuf *m;
|
||||
register count;
|
||||
register int count;
|
||||
|
||||
if ((m = mp) == NULL)
|
||||
return;
|
||||
|
|
|
@ -71,7 +71,9 @@ socreate(dom, aso, type, proto)
|
|||
register int type;
|
||||
int proto;
|
||||
{
|
||||
#ifndef __REACTOS__
|
||||
struct proc *p = curproc; /* XXX */
|
||||
#endif
|
||||
register struct protosw *prp;
|
||||
register struct socket *so;
|
||||
register int error;
|
||||
|
@ -335,7 +337,9 @@ sosend(so, addr, uio, top, control, flags)
|
|||
struct mbuf *control;
|
||||
int flags;
|
||||
{
|
||||
#ifndef __REACTOS__
|
||||
struct proc *p = curproc; /* XXX */
|
||||
#endif
|
||||
struct mbuf **mp;
|
||||
register struct mbuf *m;
|
||||
register long space, len, resid;
|
||||
|
|
Loading…
Reference in a new issue