From owner-freebsd-hackers@FreeBSD.ORG Sun Mar 22 12:09:12 2015 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0D7D4D54; Sun, 22 Mar 2015 12:09:12 +0000 (UTC) Received: from mail-wi0-x22a.google.com (mail-wi0-x22a.google.com [IPv6:2a00:1450:400c:c05::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CA6D6899; Sun, 22 Mar 2015 12:09:10 +0000 (UTC) Received: by wixw10 with SMTP id w10so18759909wix.0; Sun, 22 Mar 2015 05:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=BrYyz0zEtgYA1KjjuKP9xrOacZKOgf967HzWI/USoXQ=; b=te0ppDeyjzycP6dvs8al/KESjtEZOxGs+rSU8KMVunVP1FCovt7n3wAOwisU5y0TmC 0sRbYGQXsxzOq44ywyML/LRbvpiQaSRCtfVwmGJNHQA6lRQmpO0Nk3O/toIzLKRdCdIj VTML/X1+7qNcVJYOre4XJxEHeYriN3SaS/0nnKKAnlqwfVo+JmGIGkeRW9HCdx8AJRZ4 20MsvD8tmN+tcgVnmxtXUnV6cUI3KkIfH9EU1bbGiG924nJbe4UwwNOtYCv16YmJQHuI +hcWysKZVFhIaOqv8s4+YEzCLOp4wvRUMuH3HB0tvM3Yb2JS2Nj2HuWjVExsWCkX2clg Wk6Q== MIME-Version: 1.0 X-Received: by 10.194.57.170 with SMTP id j10mr104783943wjq.102.1427026149249; Sun, 22 Mar 2015 05:09:09 -0700 (PDT) Received: by 10.28.98.70 with HTTP; Sun, 22 Mar 2015 05:09:08 -0700 (PDT) In-Reply-To: References: Date: Sun, 22 Mar 2015 20:09:08 +0800 Message-ID: Subject: Re: Self introduciton of Hao Sun and thoughts on LibNetstat From: Hao Sun To: Gabor Pali X-Mailman-Approved-At: Sun, 22 Mar 2015 14:49:11 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: freebsd-hackers@freebsd.org, Robert Watson X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Mar 2015 12:09:12 -0000 Hi G=C3=A1bor, Thanks a lot for the relpy. Your comments provide me a lot of valuable information, and now I'm getting clearer about what the target is and what need I do in the future. Following your guidance, I've cloned the FreeBSD mirror from GitHub and will get down to have an initial scratch with the latest version. Yeah, 6 years passed by, a lot have been changed and updated during that period. Also I had a glance over the existing user-space code and get cleared about the basic code strcture and abstratactions of the previous version. Now I think it's time to propose my ideas about the project and write the proposal. However there is one more quesiton. On the project's wiki page ( https://wiki.freebsd.org/LibNetstat) , I think the target for GSoC 2015 is to finish the tasks haven't been done in the following table. But accroding to your comments in the emails, it seems like I need to start the job from scratch. Thus the question is should I keep the existing code and add new features to the previous version or just start the project from the very beginning? [image: =E5=86=85=E5=B5=8C=E5=9B=BE=E7=89=87 2] Thanks, Hao 2015-03-21 16:57 GMT+08:00 Gabor Pali : > [Please CC me in your replies, I am not on freebsd-hackers.] > > Hi Hao, > > 2015-03-19 1:53 GMT+01:00 Hao Sun : > > I saw the project introduction of LibNetstat on > > FreeBSD=E2=80=99s GSoC 15=E2=80=99 homepage and was attracted by the pr= oject. > > 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 ri= ch > > project experiences on C, namely the FontDesigner project in the lab, t= he > > 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 jo= bs > > 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 th= e > 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 > version > > 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 t= o > > 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_libst= at/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 >