#ifdef KERNEL
#include "../afs/param.h"
+#include <afsconfig.h>
#include "../afs/sysincludes.h"
#include "../afs/afsincludes.h"
#ifndef UKERNEL
# include "../afsint/rxgen_consts.h"
#else /* KERNEL */
# include <afs/param.h>
+# include <afsconfig.h>
# include <sys/types.h>
# include <errno.h>
#ifdef AFS_NT40_ENV
# include "rx_internal.h"
# include <afs/rxgen_consts.h>
#endif /* KERNEL */
-
-#ifdef RXDEBUG
-extern afs_uint32 LWP_ThreadId();
-#endif /* RXDEBUG */
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
int (*registerProgram)() = 0;
int (*swapNameProgram)() = 0;
void rx_StartServer(donateMe)
{
register struct rx_service *service;
- register int i, nProcs;
+ register int i, nProcs=0;
SPLVAR;
clock_NewTime();
NETPRI;
for(i=0; i<RX_MAXCALLS; i++) {
- if (tcall = aconn->call[i]) {
+ if ((tcall = aconn->call[i])) {
if ((tcall->state == RX_STATE_ACTIVE)
|| (tcall->state == RX_STATE_PRECALL)) {
USERPRI;
{
struct rx_serverQueueEntry *sq;
register struct rx_call *call = (struct rx_call *) 0, *choice2;
- struct rx_service *service;
+ struct rx_service *service = NULL;
SPLVAR;
NETPRI;
AFS_RXGLOCK();
MUTEX_ENTER(&freeSQEList_lock);
- if (sq = rx_FreeSQEList) {
+ if ((sq = rx_FreeSQEList)) {
rx_FreeSQEList = *(struct rx_serverQueueEntry **)sq;
MUTEX_EXIT(&freeSQEList_lock);
} else { /* otherwise allocate a new one and return that */
afs_uint32 serial;
/* because there are CM's that are bogus, sending weird values for this. */
afs_uint32 skew = 0;
- int needRxStart = 0;
int nbytes;
int missing;
int acked;
{
struct rx_debugIn in;
afs_int32 rc = 0;
- int i;
/*
* supportedValues is currently unused, but added to allow future
MUTEX_ENTER(&freeSQEList_lock);
- while (np = rx_FreeSQEList) {
+ while ((np = rx_FreeSQEList)) {
rx_FreeSQEList = *(struct rx_serverQueueEntry **)np;
MUTEX_DESTROY(&np->lock);
rxi_Free(np, sizeof(*np));
ptr = *stats = (afs_uint32 *) rxi_Alloc(space);
if (ptr != NULL) {
- register struct rx_peer *pp;
- int i;
- int num_copied = 0;
rx_interface_stat_p rpc_stat, nrpc_stat;
ptr = *stats = (afs_uint32 *) rxi_Alloc(space);
if (ptr != NULL) {
- int i;
- int num_copied = 0;
rx_interface_stat_p rpc_stat, nrpc_stat;
char *fix_offset;
int rxi_ReadvProc();
int rxi_FillReadVec();
void rxi_FlushWrite();
+int rxi_getAllAddrMaskMtu();
+int rx_getAllAddr();
+void rxi_FreePacket();
+int rxi_AllocDataBuf();
+void rxi_RestoreDataBufs();
+void rxi_Sleep();
+void rxi_InitializeThreadSupport();
+int rxi_Recvmsg();
+int rxi_Sendmsg();
+int rxi_IsConnInteresting();
+afs_int32 rx_SlowReadPacket();
+afs_int32 rx_SlowWritePacket();
+afs_int32 rx_SlowGetInt32();
+void rxi_StopListener();
+void rxi_InitPeerParams();
+void rxi_FreeAllPackets();
+void rxi_SendPacketList();
+void rxi_SendPacket();
+void rxi_MorePackets();
+void rx_CheckPackets();
+void rxi_Wakeup();
void rx_PrintStats();
void rx_PrintPeerStats();
void rx_SetArrivalProc();
int rx_KeyCreate(rx_destructor_t);
void *rx_GetSpecific(struct rx_connection *conn, int key);
void rx_SetSpecific(struct rx_connection *conn, int key, void *ptr);
+osi_socket rxi_GetUDPSocket(u_short port);
#endif /* KERNEL */
int ntoh_syserr_conv(int error);
#ifndef KERNEL
/* Make clock uninitialized. */
+int
clock_UnInit()
{
clockInitialized = 0;
+ return 0;
}
#endif
#endif /* AFS_PTHREAD_ENV */
/* Some comparison operators for clock values */
-#define clock_Gt(a, b) ((a)->sec>(b)->sec || (a)->sec==(b)->sec && (a)->usec>(b)->usec)
-#define clock_Ge(a, b) ((a)->sec>(b)->sec || (a)->sec==(b)->sec && (a)->usec>=(b)->usec)
+#define clock_Gt(a, b) ((a)->sec>(b)->sec || ((a)->sec==(b)->sec && (a)->usec>(b)->usec))
+#define clock_Ge(a, b) ((a)->sec>(b)->sec || ((a)->sec==(b)->sec && (a)->usec>=(b)->usec))
#define clock_Eq(a, b) ((a)->sec==(b)->sec && (a)->usec==(b)->usec)
-#define clock_Le(a, b) ((a)->sec<(b)->sec || (a)->sec==(b)->sec && (a)->usec<=(b)->usec)
-#define clock_Lt(a, b) ((a)->sec<(b)->sec || (a)->sec==(b)->sec && (a)->usec<(b)->usec)
+#define clock_Le(a, b) ((a)->sec<(b)->sec || ((a)->sec==(b)->sec && (a)->usec<=(b)->usec))
+#define clock_Lt(a, b) ((a)->sec<(b)->sec || ((a)->sec==(b)->sec && (a)->usec<(b)->usec))
/* Is the clock value zero? */
#define clock_IsZero(c) ((c)->sec == 0 && (c)->usec == 0)
struct rx_connection **conn) {
cache_entry_p new_entry;
- if(new_entry = (cache_entry_p) malloc(sizeof(cache_entry_t))) {
+ if((new_entry = (cache_entry_p) malloc(sizeof(cache_entry_t)))) {
new_entry->conn = *conn;
new_entry->parts = *parts;
new_entry->inUse = 1;
{
register struct rxevent *ev, *evqe, *evqpr;
register struct rxepoch *ep, *epqe, *epqpr;
- struct clock ept;
int isEarliest = 0;
MUTEX_ENTER(&rxevent_lock);
struct ifconf ifc;
struct ifreq ifs[NIFS], *ifr;
struct sockaddr_in *a;
+#if defined(AFS_AIX41_ENV) || defined(AFS_USR_AIX_ENV)
char *cp, *cplim; /* used only for AIX 41 */
+#endif
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0)
int s;
int i, len, count=0;
struct ifconf ifc;
- struct ifreq ifs[NIFS], *ifr, tempIfr;
+ struct ifreq ifs[NIFS], *ifr;
struct sockaddr_in *a;
+#if defined(AFS_AIX41_ENV) || defined(AFS_USR_AIX_ENV)
char *cp, *cplim; /* used only for AIX 41 */
+#endif
#if !defined(AFS_USERSPACE_IP_ADDR)
count = rx_getAllAddr(addrBuffer, 1024);
}
PROCESS rx_listenerPid = 0; /* LWP process id of socket listener process */
-void rx_ListenerProc(void *dummy);
+static void rx_ListenerProc(void *dummy);
/*
* Delay the current thread the specified number of seconds.
afs_int32 nextPollTime; /* time to next poll FD before sleeping */
int lastPollWorked, doingPoll; /* true iff last poll was useful */
struct timeval tv, *tvp;
- int i, code;
+ int code;
+#ifdef AFS_NT40_ENV
+ int i;
+#endif
PROCESS pid;
char name[MAXTHREADNAMELENGTH] = "srv_0";
}
if (sfds)
IOMGR_FreeFDSet(sfds);
+ return 0;
}
*/
#include <afs/param.h>
+#include <afsconfig.h>
#ifdef KERNEL
#include <afs/sysincludes.h>
#include <afs/afsincludes.h>
#ifdef AFS_PTHREAD_ENV
#include "rx.h"
#endif /* AFS_PTHREAD_ENV */
+#include <stdlib.h>
#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
/*
* We currently only include below the errors that
* Convert from the local (host) to the standard
* (network) system error code.
*/
+int
hton_syserr_conv(code)
register afs_int32 code;
{
* Convert from the standard (Network) format to the
* local (host) system error code.
*/
+int
ntoh_syserr_conv(int code)
{
register afs_int32 err;
return (char *)(mem_alloc(x));
}
+int
osi_free(x, size)
char *x;
afs_int32 size;
{
- if ((x == &memZero) || !x) return;
+ if ((x == &memZero) || !x) return 0;
LOCK_MALLOC_STATS
osi_alloccnt--; osi_allocsize -= size;
UNLOCK_MALLOC_STATS
mem_free(x, size);
+ return 0;
}
#endif
#endif /* KERNEL */
#ifdef KERNEL
#include "../afs/param.h"
+#include <afsconfig.h>
#if defined(UKERNEL)
#include "../afs/sysincludes.h"
#include "../afs/afsincludes.h"
#include "../rx/rx_globals.h"
#else /* KERNEL */
#include <afs/param.h>
+#include <afsconfig.h>
#include "sys/types.h"
#include <sys/stat.h>
#include <errno.h>
#include <lwp.h>
#include "rx_internal.h"
#endif /* KERNEL */
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#ifdef RX_LOCKS_DB
osi_Panic("rxi_AllocPacket: packet not free\n");
c->header.flags = 0;
+#ifdef KERNEL
done:
+#endif
MUTEX_EXIT(&rx_freePktQ_lock);
USERPRI;
for (i=p->niovecs; nb>0 && i<RX_MAXWVECS; i++) {
register struct rx_packet *cb;
- if (cb = allocCBuf(class)) {
+ if ((cb = allocCBuf(class))) {
p->wirevec[i].iov_base = (caddr_t) cb->localdata;
p->wirevec[i].iov_len = RX_CBUFFERSIZE;
nb -= RX_CBUFFERSIZE;
while (!(call->error)) {
MUTEX_ENTER(&rx_freePktQ_lock);
/* if an error occurred, or we get the packet we want, we're done */
- if (p = rxi_AllocPacketNoLock(RX_PACKET_CLASS_SEND)) {
+ if ((p = rxi_AllocPacketNoLock(RX_PACKET_CLASS_SEND))) {
MUTEX_EXIT(&rx_freePktQ_lock);
want += delta;
tconn.serial = htonl(tc->serial);
for(j=0;j<RX_MAXCALLS;j++) {
tconn.callNumber[j] = htonl(tc->callNumber[j]);
- if (tcall=tc->call[j]) {
+ if ((tcall=tc->call[j])) {
tconn.callState[j] = tcall->state;
tconn.callMode[j] = tcall->mode;
tconn.callFlags[j] = tcall->flags;
*/
case RX_DEBUGI_GETPEER: {
- int i, j;
+ int i;
register struct rx_peer *tp;
struct rx_debugPeer tpeer;
int i;
int nbytes;
int saven = 0;
- size_t savelen;
+ size_t savelen = 0;
#ifdef KERNEL
int waslocked = ISAFS_GLOCK();
#endif
void rxi_SendPacket(struct rx_connection * conn, struct rx_packet *p,
int istack)
{
+#if defined(KERNEL)
int waslocked;
+#endif
struct sockaddr_in addr;
register struct rx_peer *peer = conn->peer;
osi_socket socket;
int len,
int istack)
{
+#if defined(AFS_SUN5_ENV) && defined(KERNEL)
int waslocked;
+#endif
struct sockaddr_in addr;
register struct rx_peer *peer = conn->peer;
osi_socket socket;
- struct rx_packet *p;
+ struct rx_packet *p = NULL;
struct iovec wirevec[RX_MAXIOVECS];
int i, length;
afs_uint32 serial;
* packet sends (it's repeated elsewhere) */
register struct rx_packet *p;
unsigned int i = 0;
- int savelen, saven = 0;
+ int savelen = 0, saven = 0;
int channel, callNumber;
if (call) {
channel = call->channel;
#ifdef KERNEL
#include "../afs/param.h"
+#include <afsconfig.h>
#ifndef UKERNEL
#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
#include "../afs/sysincludes.h"
#endif /* AFS_ALPHA_ENV */
#else /* KERNEL */
# include <afs/param.h>
+# include <afsconfig.h>
# include <sys/types.h>
#ifndef AFS_NT40_ENV
# include <sys/socket.h>
# include "rx_globals.h"
# include "rx_internal.h"
#endif /* KERNEL */
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#ifdef RX_LOCKS_DB
* work. It may reduce the length of the packet by up
* to conn->maxTrailerSize, to reflect the length of the
* data + the header. */
- if (error = RXS_CheckPacket(conn->securityObject, call, rp)) {
+ if ((error = RXS_CheckPacket(conn->securityObject, call, rp))) {
/* Used to merely shut down the call, but now we
* shut down the whole connection since this may
* indicate an attempt to hijack it */
struct rx_packet *rp;
struct rx_packet *curp;
struct iovec *call_iov;
- struct iovec *cur_iov;
+ struct iovec *cur_iov = NULL;
curp = call->currentPacket;
if (curp) {
* work. It may reduce the length of the packet by up
* to conn->maxTrailerSize, to reflect the length of the
* data + the header. */
- if (error = RXS_CheckPacket(conn->securityObject, call, rp)) {
+ if ((error = RXS_CheckPacket(conn->securityObject, call, rp))) {
/* Used to merely shut down the call, but now we
* shut down the whole connection since this may
* indicate an attempt to hijack it */
}
#endif /* RX_ENABLE_LOCKS */
}
- if (cp = rxi_AllocSendPacket(call, nbytes)) {
+ if ((cp = rxi_AllocSendPacket(call, nbytes))) {
call->currentPacket = cp;
call->nFree = cp->length;
call->curvec = 1; /* 0th vec is always header */
int nio;
int nbytes;
{
- struct rx_connection *conn = call->conn;
struct rx_packet *cp = call->currentPacket;
register struct rx_packet *tp; /* Temporary packet pointer */
register struct rx_packet *nxp; /* Next packet pointer, for queue_Scan */
nextio = 0;
queue_Init(&tmpq);
do {
- unsigned int t;
-
if (call->nFree == 0 && cp) {
clock_NewTime(); /* Bogus: need new time package */
/* The 0, below, specifies that it is not the last packet:
#include <sys/types.h>
#include <afs/param.h>
+#include <afsconfig.h>
#include <errno.h>
#ifdef AFS_NT40_ENV
#include <winsock2.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <netdb.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
+#endif
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#ifdef HAVE_STRING_H
#include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+#include <string.h>
+#endif
#include <sys/stat.h>
#include <afs/stds.h>
#include <afs/cmd.h>