First stage port to 64 bit

This commit is contained in:
Michiel Broek
2005-10-11 20:49:41 +00:00
parent ac4e2dce0a
commit 1dfaf10c20
222 changed files with 1620 additions and 1563 deletions

View File

@@ -14,9 +14,9 @@ typedef struct _tocall {
callstat cst; /* Last call status */
int calling; /* Is calling */
pid_t taskpid; /* Task pid number */
unsigned long moflags; /* Modem flags */
unsigned long diflags; /* ISDN flags */
unsigned long ipflags; /* TCP/IP flags */
unsigned int moflags; /* Modem flags */
unsigned int diflags; /* ISDN flags */
unsigned int ipflags; /* TCP/IP flags */
} tocall;

View File

@@ -4,7 +4,7 @@
* Purpose ...............: Crc32 calculations
*
*****************************************************************************
* Copyright (C) 1993-2004
* Copyright (C) 1993-2005
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@@ -70,7 +70,7 @@
/* using byte-swap instructions. */
unsigned long crc32tab[] = { /* CRC polynomial 0xedb88320 */
unsigned int crc32tab[] = { /* CRC polynomial 0xedb88320 */
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
@@ -108,9 +108,9 @@ unsigned long crc32tab[] = { /* CRC polynomial 0xedb88320 */
unsigned long StringCRC32(char *str)
unsigned int StringCRC32(char *str)
{
unsigned long crc;
unsigned int crc;
for (crc = 0xffffffff; *str; str++)
crc = crc32tab[((int)crc^(*str)) & 0xff] ^ ((crc>>8) & 0x00ffffff);

View File

@@ -96,15 +96,15 @@ int load_node(fidoaddr n)
char *size_str(long);
char *size_str(long size)
char *size_str(int);
char *size_str(int size)
{
static char fmt[25];
if (size > 1048575) {
snprintf(fmt, 25, "%ldK", size / 1024);
snprintf(fmt, 25, "%dK", size / 1024);
} else {
snprintf(fmt, 25, "%ld ", size);
snprintf(fmt, 25, "%d ", size);
}
return fmt;
}
@@ -268,7 +268,7 @@ int outstat()
DIR *dp = NULL;
struct dirent *de;
struct stat sb;
unsigned long ibnmask = 0, ifcmask = 0, itnmask = 0;
unsigned int ibnmask = 0, ifcmask = 0, itnmask = 0;
nodelist_modem **tmpm;
for (tmpm = &nl_tcpip; *tmpm; tmpm=&((*tmpm)->next)) {

View File

@@ -21,10 +21,10 @@ typedef struct _alist
time_t time; /* Date/time of mail/files */
off_t size; /* Total size of mail/files */
callstat cst; /* Last call status */
unsigned long olflags; /* Nodelist online flags */
unsigned long moflags; /* Nodelist modem flags */
unsigned long diflags; /* Nodelist ISDN flags */
unsigned long ipflags; /* Nodelist TCP/IP flags */
unsigned int olflags; /* Nodelist online flags */
unsigned int moflags; /* Nodelist modem flags */
unsigned int diflags; /* Nodelist ISDN flags */
unsigned int ipflags; /* Nodelist TCP/IP flags */
int t1; /* First Txx flag */
int t2; /* Second Txx flag */
int callmode; /* Call method */

View File

@@ -161,7 +161,7 @@ int ping_send(struct in_addr addr)
struct protoent *pe;
int SOL_IP;
#endif
unsigned long sum;
unsigned int sum;
unsigned short *ptr;
#ifndef __linux__
@@ -269,7 +269,7 @@ int ping_receive(struct in_addr addr)
if (len > sizeof(struct iphdr)) {
memcpy(&iph, buf, sizeof(iph));
if (len - iph.ip_hl * 4 >= ICMP_BASEHDR_LEN) {
memcpy(&icmpp, ((unsigned long int *)buf)+iph.ip_hl, sizeof(icmpp));
memcpy(&icmpp, ((uint32_t *)buf)+iph.ip_hl, sizeof(icmpp));
if (iph.ip_saddr == addr.s_addr && icmpp.icmp_type == ICMP_ECHOREPLY &&
ntohs(icmpp.icmp_id) == id && ntohs(icmpp.icmp_seq) == p_sequence) {
return 0;

View File

@@ -11,10 +11,10 @@
typedef struct _pp_list {
struct _pp_list *next;
char tty[7]; /* tty name of the port */
unsigned long mflags; /* Analogue modem flags */
unsigned long dflags; /* ISDN flags */
unsigned int mflags; /* Analogue modem flags */
unsigned int dflags; /* ISDN flags */
int locked; /* If port is locked */
long locktime; /* Time it is locked */
int locktime; /* Time it is locked */
} pp_list;

View File

@@ -38,8 +38,8 @@ typedef struct _mfs_list {
struct _mfs_list *next; /* Linked list */
char *mountpoint; /* Mountpoint */
char *fstype; /* FS type */
unsigned long size; /* Size in MB */
unsigned long avail; /* Available in MB */
unsigned int size; /* Size in MB */
unsigned int avail; /* Available in MB */
unsigned ro : 1; /* Read-Only fs. */
} mfs_list;
@@ -253,7 +253,7 @@ char *disk_check(char *token)
{
static char buf[SS_BUFSIZE];
mfs_list *tmp;
unsigned long needed, lowest = 0xffffffff;
unsigned int needed, lowest = 0xffffffff;
int rc;
strtok(token, ",");
@@ -279,9 +279,9 @@ char *disk_check(char *token)
Syslog('!', "disk_check() mutex_unlock failed rc=%d", rc);
if (lowest < needed) {
snprintf(buf, SS_BUFSIZE, "100:2,0,%ld;", lowest);
snprintf(buf, SS_BUFSIZE, "100:2,0,%d;", lowest);
} else {
snprintf(buf, SS_BUFSIZE, "100:2,1,%ld;", lowest);
snprintf(buf, SS_BUFSIZE, "100:2,1,%d;", lowest);
}
return buf;
}
@@ -315,7 +315,7 @@ char *disk_getfs()
else
ans = xstrcat(ans, (char *)",");
tt[0] = '\0';
snprintf(tt, 80, "%lu %lu %s %s %d", tmp->size, tmp->avail, tmp->mountpoint, tmp->fstype, tmp->ro);
snprintf(tt, 80, "%u %u %s %s %d", tmp->size, tmp->avail, tmp->mountpoint, tmp->fstype, tmp->ro);
ans = xstrcat(ans, tt);
if (i == 10) /* No more then 10 filesystems */
break;
@@ -343,14 +343,14 @@ char *disk_getfs()
void update_diskstat(void)
{
struct statfs sfs;
unsigned long temp;
unsigned int temp;
mfs_list *tmp;
for (tmp = mfs; tmp; tmp = tmp->next) {
if (statfs(tmp->mountpoint, &sfs) == 0) {
temp = (unsigned long)(sfs.f_bsize / 512L);
tmp->size = (unsigned long)(sfs.f_blocks * temp) / 2048L;
tmp->avail = (unsigned long)(sfs.f_bavail * temp) / 2048L;
temp = (unsigned int)(sfs.f_bsize / 512L);
tmp->size = (unsigned int)(sfs.f_blocks * temp) / 2048L;
tmp->avail = (unsigned int)(sfs.f_bavail * temp) / 2048L;
#if defined(__linux__)
/*
* The struct statfs (or statvfs) seems to have no information
@@ -385,7 +385,7 @@ void add_path(char *lpath)
FILE *fp;
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
struct statfs *mntbuf;
long mntsize;
int mntsize;
int i;
#else
#error "Don't know how to get mount paths"

View File

@@ -895,7 +895,7 @@ int command_server(char *hostname, char *parameters)
usr_list *tmp;
chn_list *tmpc;
char *name, *hops, *id, *prod, *vers, *fullname;
unsigned long token;
unsigned int token;
int ihops, found = FALSE;
name = strtok(parameters, " \0");

View File

@@ -22,7 +22,7 @@ typedef struct _ncs_list {
unsigned gotserver : 1; /* Received valid server */
struct sockaddr_in servaddr_in; /* Peer socketaddress */
int socket; /* Peer socket */
unsigned long token; /* Server token */
unsigned int token; /* Server token */
} ncs_list;

View File

@@ -56,7 +56,7 @@ char *get_sysinfo(void)
if (fread(&SYSINFO, sizeof(SYSINFO), 1, fp) == 1) {
startdate = SYSINFO.StartDate;
snprintf(buf, SS_BUFSIZE, "100:7,%ld,%ld,%ld,%ld,%ld,%s,%s;", SYSINFO.SystemCalls,
snprintf(buf, SS_BUFSIZE, "100:7,%d,%d,%d,%d,%d,%s,%s;", SYSINFO.SystemCalls,
SYSINFO.Pots, SYSINFO.ISDN, SYSINFO.Network, SYSINFO.Local,
ctime(&startdate), SYSINFO.LastCaller);
}
@@ -131,7 +131,7 @@ char *get_lastcallerrec(int Rec)
action[8] = '\0';
snprintf(buf, SS_BUFSIZE, "100:9,%s,%s,%d,%s,%s,%d,%d,%s,%s;", LCALL.UserName, LCALL.Location,
LCALL.SecLevel, LCALL.Device, LCALL.TimeOn,
LCALL.CallTime, LCALL.Calls, LCALL.Speed, action);
(int)LCALL.CallTime, LCALL.Calls, LCALL.Speed, action);
}
free(temp);

View File

@@ -63,23 +63,23 @@ extern int ZMH;
typedef struct {
long tot_clt; /* Total client connects */
long peak_clt; /* Peak simultaneous tot_cltes */
long s_error; /* Syntax errors from clients */
long c_error; /* Comms errors from clients */
int tot_clt; /* Total client connects */
int peak_clt; /* Peak simultaneous tot_cltes */
int s_error; /* Syntax errors from clients */
int c_error; /* Comms errors from clients */
} cl_stat;
typedef struct {
time_t start; /* Start date/time */
time_t laststart; /* Last start date/time */
time_t daily; /* Last daily update */
long startups; /* Total starts */
long clients; /* Connected clients */
int start; /* Start date/time */
int laststart; /* Last start date/time */
int daily; /* Last daily update */
int startups; /* Total starts */
int clients; /* Connected clients */
cl_stat total; /* Total statistics */
cl_stat today; /* Todays statistics */
unsigned open : 1; /* Is BBS open */
unsigned long sequence; /* Sequencer counter */
unsigned int sequence; /* Sequencer counter */
} status_r;
@@ -114,7 +114,7 @@ void status_init()
memset((char *)&status, 0, sizeof(status_r));
status.start = time(NULL);
status.daily = time(NULL);
status.sequence = (unsigned long)time(NULL);
status.sequence = (unsigned int)time(NULL);
stat_fd = open(stat_fn, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
cnt = write(stat_fd, &status, sizeof(status_r));
Syslog('+', "New statusfile created");
@@ -319,8 +319,8 @@ char *stat_status()
chncnt++;
for (tmpu = users; tmpu; tmpu = tmpu->next)
usrcnt++;
snprintf(buf, 160, "100:23,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%d,%d,%d,%d,%d,%2.2f,%lu,%d,%d,%d;",
(long)status.start, (long)status.laststart, (long)status.daily,
snprintf(buf, 160, "100:23,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%2.2f,%u,%d,%d,%d;",
(int)status.start, (int)status.laststart, (int)status.daily,
status.startups, status.clients,
status.total.tot_clt, status.total.peak_clt,
status.total.s_error, status.total.c_error,
@@ -360,13 +360,13 @@ char *getseq(void)
buf[0] = '\0';
status.sequence++;
status_write();
snprintf(buf, 80, "100:1,%lu;", status.sequence);
snprintf(buf, 80, "100:1,%u;", status.sequence);
return buf;
}
unsigned long gettoken(void)
unsigned int gettoken(void)
{
status.sequence++;
status_write();

View File

@@ -17,7 +17,7 @@ void stat_inc_cerr(void); /* Increase comms error */
char *stat_status(void); /* Return status record */
int stat_bbs_stat(void); /* Get BBS open status */
char *getseq(void); /* Get next sequence number */
unsigned long gettoken(void); /* Get next sequence number */
unsigned int gettoken(void); /* Get next sequence number */
int get_zmh(void); /* Check Zone Mail Hour */
int sem_set(char *, int); /* Set/Reset semafore */
char *sem_status(char *); /* Get semafore status */

View File

@@ -42,7 +42,7 @@ extern struct sysconfig CFG;
extern struct _fidonethdr fidonethdr;
extern struct _fidonet fidonet;
extern struct taskrec TCFG;
unsigned long lcrc = 0, tcrc = 1;
unsigned int lcrc = 0, tcrc = 1;
int lcnt = 0, lchr;
static char *pbuff = NULL;
@@ -409,7 +409,7 @@ int mkdirs(char *name, mode_t mode)
/*
* Return size of file, or -1 if file doesn't exist
*/
long file_size(char *path)
int file_size(char *path)
{
static struct stat sb;

View File

@@ -33,7 +33,7 @@ void RemoveSema(char *);
int IsSema(char *);
int file_exist(char *, int);
int mkdirs(char *, mode_t);
long file_size(char *);
int file_size(char *);
time_t file_time(char *);
char *ascfnode(faddr *, int);
char *fido2str(fidoaddr, int);