1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-26 07:55:01 +00:00

portability fixes

This commit is contained in:
Luigi Rizzo 2010-03-04 21:52:40 +00:00
parent ae8b199313
commit b05934e2cb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=204736
2 changed files with 17 additions and 2 deletions

View File

@ -12,11 +12,9 @@
#include <strings.h> /* bzero, ffs, ... */
#include <string.h> /* strcmp */
#include <errno.h>
#include <inttypes.h>
#include <sys/queue.h>
#include <sys/time.h>
extern int debug;
#define ND(fmt, args...) do {} while (0)
#define D1(fmt, args...) do {} while (0)
@ -141,6 +139,10 @@ struct dn_alg {
#endif
#ifndef __FreeBSD__
int fls(int);
#endif
static inline void
mq_append(struct mq *q, struct mbuf *m)
{

View File

@ -74,3 +74,16 @@ ipdn_bound_var(int *v, int dflt, int lo, int hi, const char *msg)
return *v;
}
#ifndef __FreeBSD__
int
fls(int mask)
{
int bit;
if (mask == 0)
return (0);
for (bit = 1; mask != 1; bit++)
mask = (unsigned int)mask >> 1;
return (bit);
}
#endif