Fix Compile Error with gcc 11.3.0(in Ubuntu 22.04). Close #736.

This commit is contained in:
fengbojiang 2023-02-16 15:14:27 +08:00
parent 761dee801d
commit c35e5fda17
4 changed files with 26 additions and 1 deletions

View File

@ -545,6 +545,11 @@ kevent(int kq, const struct kevent *changelist, int nchanges,
return ff_kevent(kq, changelist, nchanges, eventlist, nevents, timeout);
}
/*
* It is need to modify the definition, such as Ubuntu 22.04 or later.
*
* int(struct timeval * restrict, void * restrict)
*/
int
gettimeofday(struct timeval *tv, struct timezone *tz)
{

View File

@ -771,7 +771,7 @@ linker_file_add_dependency(linker_file_t file, linker_file_t dep)
file->deps[file->ndeps] = dep;
file->ndeps++;
KLD_DPF(FILE, ("linker_file_add_dependency:"
" adding %s as dependency for %s\n",
" adding %s as dependency for %s\n",
dep->filename, file->filename));
return (0);
}
@ -1862,7 +1862,11 @@ linker_hints_lookup(const char *path, int pathlen, const char *modname,
goto bad;
best = cp = NULL;
error = VOP_GETATTR(nd.ni_vp, &vattr, cred);
#ifdef FSTACK
if (error || vattr.va_size == 0)
#else
if (error)
#endif
goto bad;
/*
* XXX: we need to limit this number to some reasonable value

View File

@ -760,7 +760,11 @@ imf_get_source(struct in_mfilter *imf, const struct sockaddr_in *psin,
if (lims == NULL) {
if (imf->imf_nsrc == in_mcast_maxsocksrc)
return (ENOSPC);
#ifdef FSTACK
nims = malloc(sizeof(struct ip_msource), M_INMFILTER,
#else
nims = malloc(sizeof(struct in_msource), M_INMFILTER,
#endif
M_NOWAIT | M_ZERO);
if (nims == NULL)
return (ENOMEM);
@ -791,7 +795,11 @@ imf_graft(struct in_mfilter *imf, const uint8_t st1,
struct ip_msource *nims;
struct in_msource *lims;
#ifdef FSTACK
nims = malloc(sizeof(struct ip_msource), M_INMFILTER,
#else
nims = malloc(sizeof(struct in_msource), M_INMFILTER,
#endif
M_NOWAIT | M_ZERO);
if (nims == NULL)
return (NULL);

View File

@ -729,7 +729,11 @@ im6f_get_source(struct in6_mfilter *imf, const struct sockaddr_in6 *psin,
if (lims == NULL) {
if (imf->im6f_nsrc == in6_mcast_maxsocksrc)
return (ENOSPC);
#ifdef FSTACK
nims = malloc(sizeof(struct ip6_msource), M_IN6MFILTER,
#else
nims = malloc(sizeof(struct in6_msource), M_IN6MFILTER,
#endif
M_NOWAIT | M_ZERO);
if (nims == NULL)
return (ENOMEM);
@ -760,7 +764,11 @@ im6f_graft(struct in6_mfilter *imf, const uint8_t st1,
struct ip6_msource *nims;
struct in6_msource *lims;
#ifdef FSTACK
nims = malloc(sizeof(struct ip6_msource), M_IN6MFILTER,
#else
nims = malloc(sizeof(struct in6_msource), M_IN6MFILTER,
#endif
M_NOWAIT | M_ZERO);
if (nims == NULL)
return (NULL);