From owner-p4-projects@FreeBSD.ORG Tue May 4 06:03:17 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 113A51065742; Tue, 4 May 2010 06:03:17 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 97BDB106572F for ; Tue, 4 May 2010 06:03:16 +0000 (UTC) (envelope-from pgj@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 849108FC17 for ; Tue, 4 May 2010 06:03:16 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o4463GKU051902 for ; Tue, 4 May 2010 06:03:16 GMT (envelope-from pgj@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o4463GGF051900 for perforce@freebsd.org; Tue, 4 May 2010 06:03:16 GMT (envelope-from pgj@FreeBSD.org) Date: Tue, 4 May 2010 06:03:16 GMT Message-Id: <201005040603.o4463GGF051900@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to pgj@FreeBSD.org using -f From: Gabor Pali To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 177694 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 06:03:17 -0000 http://p4web.freebsd.org/@@177694?ac=10 Change 177694 by pgj@csupor on 2010/05/04 06:03:09 Fix -O2 compilation problem (temporarily). Affected files ... .. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_internal.h#64 edit .. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_stat.c#27 edit .. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_util.c#73 edit Differences ... ==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_internal.h#64 (text+ko) ==== @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009 Gabor Pali + * Copyright (c) 2009, 2010 Gabor Pali * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -319,6 +319,12 @@ struct bpf_type *bpti_next; }; +/* Timestamp type. */ +struct timestamp_type { + u_int32_t ts_sec; + u_int32_t ts_usec; +}; + /* General statistics type. */ struct stat_type { enum stat stt_type; @@ -360,7 +366,8 @@ #ifdef SCTP struct sctp_stat { - struct sctpstat s; + struct timestamp_type discontinuitytime; + struct sctpstat *s; }; #endif @@ -433,12 +440,6 @@ }; #endif -/* Timestamp type. */ -struct timestamp_type { - u_int32_t ts_sec; - u_int32_t ts_usec; -}; - struct val2str { int val; const char *str; ==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_stat.c#27 (text+ko) ==== @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009 Gabor Pali + * Copyright (c) 2009, 2010 Gabor Pali * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -204,6 +204,24 @@ break; #endif /* !IPSEC */ + /* + * XXX : Try to avoid breaking strict aliasing rules, but it might not be + * the best solution. + */ + +#ifdef SCTP + case stat_SCTP: + sttp->stt_data = malloc(sizeof(struct sctp_stat)); + if (sttp->stt_data == NULL) { + sttp->stt_error = NETSTAT_ERROR_NOMEMORY; + free(buffer); + return(-1); + } + ((struct sctp_stat *)sttp->stt_data)->discontinuitytime.ts_sec = ((struct sctpstat *)buffer)->sctps_discontinuitytime.tv_sec; + ((struct sctp_stat *)sttp->stt_data)->discontinuitytime.ts_usec = ((struct sctpstat *)buffer)->sctps_discontinuitytime.tv_usec; + ((struct sctp_stat *)sttp->stt_data)->s = (struct sctpstat *)buffer; + break; +#endif /* !SCTP */ default: sttp->stt_data = buffer; } ==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_util.c#73 (text+ko) ==== @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009 Gabor Pali + * Copyright (c) 2009, 2010 Gabor Pali * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1298,7 +1298,8 @@ void netstat_stat_free(struct stat_type *sttp) { - if (sttp->stt_type == stat_IPcomp) + if (sttp->stt_type == stat_IPcomp || + sttp->stt_type == stat_SCTP) free(((struct ipcomp_stat *)sttp->stt_data)->s); free(sttp->stt_data); free(sttp); @@ -1655,16 +1656,12 @@ #ifdef SCTP #define SCTP_ACC(field) \ - STATS_ACC(u_int32_t,sctp,field) + STATS_ACCP(u_int32_t,sctp,field) const struct timestamp_type * netstat_sctps_get_discontinuitytime(const struct sctp_stat *ssp) { -// return ((const struct timestamp_type *)&ssp->s.sctps_discontinuitytime); - const struct timestamp_type * result; - struct sctpstat ss = ssp->s; - result = (const struct timestamp_type *)&ss.sctps_discontinuitytime; - return result; + return &ssp->discontinuitytime; } STATS_GET(sctp,SCTP);