0

我在 tcp_cubic.c中包含了以下printk语句

static u32 bictcp_recalc_ssthresh(struct sock *sk)
{
  ..

  if (tp->snd_cwnd < ca->last_max_cwnd && fast_convergence)

      ca->last_max_cwnd = (tp->snd_cwnd * (BICTCP_BETA_SCALE + beta))
          / (2 * BICTCP_BETA_SCALE);
  else
      ca->last_max_cwnd = tp->snd_cwnd;

  ca->loss_cwnd = tp->snd_cwnd;


  printk(KERN_INFO "ssthresh is %s", snd_cwnd); // <<<--- here

  return max((tp->snd_cwnd * beta) / BICTCP_BETA_SCALE, 2U);

}

但它不会打印 dmesg 或 syslog 中的值。这是为什么?

4

1 回答 1

0

在 Linux 3.1(例如)中,DEFAULT_MESSAGE_LOGLEVEL值为 4 和KERN_INFO6。尝试使用类似KERN_ALERT(值为 1)的内容进行打印。

您可以通过阅读/修改此 proc 文件来检查或更改默认日志级别:

cat /proc/sys/kernel/printk 

有关此文件的更多信息,请参阅man 5 proc

于 2012-04-11T07:29:27.090 回答