Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Mar 2015 09:57:27 +0100
From:      Gabor Pali <pgj@FreeBSD.org>
To:        Hao Sun <sunhao2013@gmail.com>
Cc:        freebsd-hackers@freebsd.org, Robert Watson <rwatson@freebsd.org>
Subject:   Re: Self introduciton of Hao Sun and thoughts on LibNetstat
Message-ID:  <CAHnG2CyPWsi2VghASzgMqGHpMoMsMnE1w6eCxtsxmEmeCd28JQ@mail.gmail.com>
In-Reply-To: <CADWmZpmq7aVxk5bap-ConjKesnmVZuEm0S9Nn%2Bwt6guc-GyfgA@mail.gmail.com>
References:  <CADWmZpmq7aVxk5bap-ConjKesnmVZuEm0S9Nn%2Bwt6guc-GyfgA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
[Please CC me in your replies, I am not on freebsd-hackers.]

Hi Hao,

2015-03-19 1:53 GMT+01:00 Hao Sun <sunhao2013@gmail.com>:
> I saw the project introduction of LibNetstat on
> FreeBSD=E2=80=99s GSoC 15=E2=80=99 homepage and was attracted by the proj=
ect.

Thank you for contacting us, it is always good to see fresh people
around who would like to contribute to the Project, especially as part
of the Google Summer of Code program.

> I think the LibNetstat would be fitful for me because I have related rich
> project experiences on C, namely the FontDesigner project in the lab, the
> face recognition plugin in Muticoreware and other course projects.

I believe this project is mostly about refactoring the netstat(1)
utility into a library and make the utility its client.  This could
come with many advantages, such as other programs could easily access
the services it would offer and this would also help with accessing
all the networking-related statistics in an platform-independent way,
even through the network.  The goal of the project is to come up with
an API and ABI that is convenient to use and captures all the concepts
that are currently used in netstat(1).

> I read the project description carefully and have done the following jobs
> since the monitoring organisations were published.

I think those are indeed good first steps in order to get involved.

> 1. Check out the code from //depot/projects/soc2009/pgj_libstat/. As the =
p4
> introduction article shows, maybe I need a FreeBSD.org account to get
> access into our depot. Thus would you please offer helps to create an
> account?

Please note that project you are talking about was done almost 6 years
ago.  Things can change a lot even in a year, so you may find yourself
starting again from scratch (which may be equally either good or bad
news for you).  One of those changes is that Perforce has shifted out
of the focus in the recent years, students have started to use the
Project's Subversion repositories for their works, or I believe, now
they can even choose to work with git, through GitHub.

So, I guess you would only need a GitHub account and you are ready to
fork the Git mirror of the FreeBSD src repository there:

https://github.com/freebsd/freebsd

> 2. I plan to run some demo codes to have an insight into the current vers=
ion
> of LibNetstat. Do we have demo codes or test cases which could help me
> get familir with the code?

It is also keep in mind that the original libnetstat code was written
and kept updated until 2011, which assumes an older base system (and
kernel) version of FreeBSD.  Again, many changes might have changed
(and I am sure they have indeed changed) in the recent years, like the
kernel now has nice atomic counters for networking statistics (thanks
to Gleb Smirnoff) which was one of the blocker issues when I stopped
working on the project.

Of course, if you would like to study the code that we wrote and you
have questions about it, I am happy answer them -- note that you can
access all the sources through the P4DB web, you do not have to check
out anything.  However, please also note I am not officially a src
committer so my comments may not be as precise as for example,
Robert's.  I have gained some experienced in working with the
networking parts of the FreeBSD kernel and I have a few years of
experience in hacking on various projects ranging from computer games
to compilers, but that is not my area of expertise therefore I may not
be up-to-date enough on the subject.

> 3. After Step #2, I want to read some existing modules, for instance,
> routing abstractions. I believe this step would help me get clear how to
> make the original interface less ABI-sensitive. So do you have any
> suggestions where to start this step?

Most of the userspace code can be found here:

https://p4web.freebsd.org/@md=3Dd&cd=3D//depot/projects/soc2009/pgj_libstat=
/src/lib/&c=3DhL4@//depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/?=
ac=3D83

They may have related kernel-side changes, but for the first stab, I
think that is what you may want to see.  "netstat.h" and
"netstat_internal.h" may tell you more about the abstractions I
created.  Feel free to dump them, and start from scratch, perhaps I
would do them differently myself if I started to work on this project
today.

For further reference, you can also study the sister libraries of
libnetstat, libprocstat and libmemstat.  They are probably much more
up-to-date with the current state of the development:

https://github.com/freebsd/freebsd/tree/master/lib/libmemstat
https://github.com/freebsd/freebsd/tree/master/lib/libprocstat

Cheers,
G=C3=A1bor



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHnG2CyPWsi2VghASzgMqGHpMoMsMnE1w6eCxtsxmEmeCd28JQ>