[ntp-GSoC] Regarding Grepping on the code for various outputs

Rajul Srivastava rajul.iitkgp at gmail.com
Sun Apr 15 13:54:27 UTC 2012


Hi Harlan,

In light of our chat I have grepped over the code for various output
strings like DPRINTF, stdout, stderr, fprintf, printf and msyslog. I
obtained huge amounts of results, and as suggested by you I did some of
'visual scanning' and made some observations that I have listed below. I
also got some ideas for the improvement of the logging system currently
used, like, if we can use the names of folder or files that contain the
function for generating a message as means for tagging the messages with
further sub-levels. With this we can have more structure in storing of log
messages. This shall be useful in the sense that even in future there are
new files added to NTP that generate messages, the logging system shall
automatically list these messages tagged with the name of the file, without
any manual changes being made to the code.

*DPRINTF*
    Definition
        Works only when DEBUG is activated/ not set to 0
        Takes the level and format of the message as argument
        For the levels for DPRINTF there are 6 levels used, specified by
numbers ranging from 1-6
        Prints a formatted message if the level of 'debug' is more than or
equals the passed level of the message


    Alternate(in case for libntp and utilities)
        TRACE()        :    similar in definiton as DPRINTF

*STDOUT, STDERR    *
    Mostly used with fprintf, fputs, fflush, etc. as FILE stream parameter

*MSYSLOG*
    Logs in messages using msyslog() function
    msyslog(): Takes in arguments specifying the LEVEL in which to log the
message and the format for storing message
        LOG LEVELS
            ERR
            INFO
            DEBUG
            NOTICE
            WARNING
            CRIT

*printf, fprintf*
    Used in lot of places and other functions like mprintf, snprintf are
also used

On running ntpd with -D9 flag
    Generate various messages relating to initialisation and execution of
ntpd

*Self Notes:*
    It appears that the levels in DPRINTF and MSYSLOG are corresponding to
each other
        1    CRIT
        2    ERROR
        3    WARNING
        4    NOTICE
        5    INFO
        6    DEBUG

*Improvements that can be introduced*
    1. We may introduce new levels like Alert and Emergency like in Syslog
    2. We may use the various folder or filenames that contain the
message-generating call to functions for sub-levels


    List of Files containing DPRINTF
include/ntp_debug.h, include/ntpd.h, libntp/authkeys.c, libntp/statestr.c,
ntpd/ntp_config.c, ntpd/ntp_control.c, ntpd/ntp_crypto.c, ntpd/ntpd.c,
ntpd/ntp_filegen.c, ntpd/ntp_io.c, ntpd/ntp_loopfilter.c,
ntpd/ntp_monitor.c, ntpd/ntp_parser.c, ntpd/ntp_peer.c, ntpd/ntp_proto.c,
ntpd/ntp_refclock.c, ntpd/ntp_request.c, ntpd/ntp_restrict.c,
ntpd/ntp_scanner.c, ntpd/ntp_timer.c, ntpd/refclock_acts.c,
ntpd/refclock_arc.c, ntpd/refclock_fg.c, ntpd/refclock_nmea.c,
ntpd/refclock_palisade.c, ntpd/refclock_parse.c, ntpd/refclock_wwvb.c,
ports/winnt/ntpd/nt_clockstuff.c, ports/winnt/ntpd/ntp_iocompletionport.c

    List of Files containing 'msyslog'
include/ntp_stdlib.h, include/ntp_syslog.h, libntp/a_md5encrypt.c,
libntp/audio.c, libntp/authreadkeys.c, libntp/emalloc.c,
libntp/humandate.c, libntp/iosignal.c, libntp/Makefile.am,
libntp/Makefile.in, libntp/msyslog.c, libntp/netof.c, libntp/ntp_intres.c,
libntp/ntp_worker.c, libntp/recvbuff.c, libntp/socket.c, libntp/ssl_init.c,
libntp/syssignal.c, libntp/systime.c, libntp/work_fork.c,
libntp/work_thread.c, libparse/clk_rawdcf.c, libparse/parse.c,
ntpdate/ntpdate.c, ntpdate/ntptime_config.c, ntpdate/ntptimeset.c,
ntpd/cmd_args.c, ntpd/ntp_config.c, ntpd/ntp_control.c, ntpd/ntp_crypto.c,
ntpd/ntpd.c, ntpd/ntp_filegen.c, ntpd/ntp_io.c, ntpd/ntp_loopfilter.c,
ntpd/ntp_parser.c, ntpd/ntp_parser.y, ntpd/ntp_peer.c, ntpd/ntp_proto.c,
ntpd/ntp_refclock.c, ntpd/ntp_request.c, ntpd/ntp_scanner.c, ntpd/ntpsim.c,
ntpd/ntp_timer.c, ntpd/ntp_util.c, ntpd/refclock_acts.c,
ntpd/refclock_arbiter.c, ntpd/refclock_arc.c, ntpd/refclock_atom.c,
ntpd/refclock_bancomm.c, ntpd/refclock_chu.c, ntpd/refclock_datum.c,
ntpd/refclock_gpsvme.c, ntpd/refclock_hopfpci.c, ntpd/refclock_hopfser.c,
ntpd/refclock_jjy.c, ntpd/refclock_jupiter.c, ntpd/refclock_leitch.c,
ntpd/refclock_msfees.c, ntpd/refclock_mx4200.c, ntpd/refclock_neoclock4x.c,
ntpd/refclock_nmea.c, ntpd/refclock_oncore.c, ntpd/refclock_palisade.c,
ntpd/refclock_parse.c, ntpd/refclock_ripencc.c, ntpd/refclock_shm.c,
ntpd/refclock_tpro.c, ntpd/refclock_true.c, ntpd/refclock_tsyncpci.c,
ntpd/refclock_tt560.c, ntpd/refclock_wwvb.c, ntpd/refclock_wwv.c,
ntpd/refclock_zyfer.c, ports/winnt/include/timepps.h,
ports/winnt/libntp/setpriority.c, ports/winnt/libntp/SetSystemTime.c,
ports/winnt/libntp/termios.c, ports/winnt/libntp/win32_io.c,
ports/winnt/ntpd/nt_clockstuff.c, ports/winnt/ntpd/ntp_iocompletionport.c,
ports/winnt/ntpd/ntservice.c, ports/winnt/vs2005/libntp.vcproj,
ports/winnt/vs2008/libntp/libntp.vcproj, sntp/crypto.c,
sntp/kod_management.c, sntp/log.c, sntp/log.h, sntp/main.c,
sntp/networking.c, tests/libntp/Makefile.am, tests/libntp/Makefile.in,
tests/libntp/msyslog.cpp

Also, sorry for the late mail as I was busier this weekend that I had
anticipated, as my exams are less than a week away and as the end of
semester is approaching I have too many class tests, submissions, and
viva-voce happening.

I am eagerly awaiting your reply. Also, please tell me at what time shall I
be able to get to you over IRC,

Regards,
Rajul

-- 
Rajul
Third year Undergraduate Student,
Department of Chemistry,
Indian Institute of Technology Kharagpur


More information about the GSoC mailing list