Linux Kernel contains only C code?

Greg KH greg at kroah.com
Thu Feb 1 12:32:29 EST 2018


On Thu, Feb 01, 2018 at 05:49:13PM +0100, Augusto Mecking Caringi wrote:
> On Thu, Feb 1, 2018 at 5:37 PM, Aruna Hewapathirane
> <aruna.hewapathirane at gmail.com> wrote:
> >> On Fri, Jan 26, 2018 at 1:58 AM, inventsekar <inventsekar at gmail.com>
> >> wrote:
> >> Hi all, ...
> >
> >> 1. May i know, other than C language, is there any other programming
> >> language is/are used inside Linux Kernel?!?!
> >> is there any c++, Perl, python programs are used for peculiar tasks inside
> >> Linux Kernel?!?!
> >
> > Well, let's find out ? If you open up a shell/terminal and change into the
> > top level directory of your Linux kernel source and run the command below:
> >
> > find . -type f -and -printf "%f\n" | grep -io '\.[^.]*$' | sort | uniq -c |
> > sort -rn ( Breaking this down, find all files+get the filename+pull out the
> > file extension+sort+only keep unique ext+sort with a stats count)
> 
> For that I recommend a tool called sloccount [1]...
> 
> BTW, running it now against Linux Kernel source I got:
> 
> Totals grouped by language (dominant language first):
> ansic:     16675070 (97.83%)
> asm:         294179 (1.73%)
> perl:         26346 (0.15%)
> sh:           18781 (0.11%)
> python:       15642 (0.09%)
> cpp:           6512 (0.04%)
> yacc:          4586 (0.03%)
> lex:           2479 (0.01%)
> awk:           1387 (0.01%)
> pascal:         231 (0.00%)
> sed:              5 (0.00%)
> Total Physical Source Lines of Code (SLOC)                = 17,045,218
> 
> 
> [1] https://www.dwheeler.com/sloccount/

'tokei' is _much_ faster when dealing with large code bases than
sloccount.  And gives a bit different view of the tree as well, I'd
recommend it over sloccount these days.

thanks,

greg k-h



More information about the Kernelnewbies mailing list