Changeset cb6fde65 in rtems


Ignore:
Timestamp:
Mar 14, 2015, 11:16:12 PM (5 years ago)
Author:
ian <ian@…>
Branches:
4.11, master
Children:
7e1a9ac
Parents:
b5b8116
git-author:
ian <ian@…> (03/14/15 23:16:12)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/09/15 12:56:02)
Message:

timecounter: Synchronize with FreeBSD

Use sbuf_printf() for sysctl strings instead of stack buffers and snprintf().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/kern_tc.c

    rb5b8116 rcb6fde65  
    3737#endif /* __rtems__ */
    3838#include <sys/cdefs.h>
    39 __FBSDID("$FreeBSD r279728 2015-03-07T18:23:32Z$");
     39__FBSDID("$FreeBSD r280012 2015-03-14T23:16:12Z$");
    4040
    4141#include "opt_compat.h"
     
    4949#include <sys/lock.h>
    5050#include <sys/mutex.h>
     51#include <sys/sbuf.h>
    5152#include <sys/sysctl.h>
    5253#include <sys/syslog.h>
     
    15501551sysctl_kern_timecounter_choice(SYSCTL_HANDLER_ARGS)
    15511552{
    1552         char buf[32], *spc;
     1553        struct sbuf sb;
    15531554        struct timecounter *tc;
    15541555        int error;
    15551556
    1556         spc = "";
    1557         error = 0;
    1558         for (tc = timecounters; error == 0 && tc != NULL; tc = tc->tc_next) {
    1559                 sprintf(buf, "%s%s(%d)",
    1560                     spc, tc->tc_name, tc->tc_quality);
    1561                 error = SYSCTL_OUT(req, buf, strlen(buf));
    1562                 spc = " ";
     1557        sbuf_new_for_sysctl(&sb, NULL, 0, req);
     1558        for (tc = timecounters; tc != NULL; tc = tc->tc_next) {
     1559                if (tc != timecounters)
     1560                        sbuf_putc(&sb, ' ');
     1561                sbuf_printf(&sb, "%s(%d)", tc->tc_name, tc->tc_quality);
    15631562        }
     1563        error = sbuf_finish(&sb);
     1564        sbuf_delete(&sb);
    15641565        return (error);
    15651566}
Note: See TracChangeset for help on using the changeset viewer.