linux strace

strace内容解析:

1226  16:49:07.930478 futex(0x7a27d710, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource temporarily unavailable)
1225  16:49:07.930878 futex(0x7a27d710, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
1226  16:49:07.931055 futex(0x7a27d710, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
1225  16:49:07.931258 <... futex resumed>) = 0
1226  16:49:07.931420 <... futex resumed>) = 0
1226  16:49:07.931672 futex(0x7a27d750, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
1225  16:49:07.931831 _newselect(1, NULL, NULL, NULL, {tv_sec=0, tv_usec=10000}) = 0 (Timeout)
1225  16:49:07.942417 futex(0x7a27d750, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
1226  16:49:07.942701 <... futex resumed>) = 0
1225  16:49:07.942815 <... futex resumed>) = 1
1226  16:49:07.942938 futex(0x7a27d710, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
1225  16:49:07.943089 futex(0x7a27d710, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
1226  16:49:07.943253 <... futex resumed>) = 0
1225  16:49:07.943357 <... futex resumed>) = 1
1226  16:49:07.943478 futex(0x7a27d710, FUTEX_WAKE_PRIVATE, 1) = 0
1225  16:49:07.943714 _newselect(1, NULL, NULL, NULL, {tv_sec=0, tv_usec=10000} <unfinished ...>
1226  16:49:07.943877 futex(0x7a27d754, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
1603  16:49:07.948246 <... _newselect resumed>) = 0 (Timeout)
1603  16:49:07.948419 _newselect(1, NULL, NULL, NULL, {tv_sec=0, tv_usec=100000} <unfinished ...>
1225  16:49:07.954114 <... _newselect resumed>) = 0 (Timeout)
1225  16:49:07.954315 futex(0x7a27d754, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
1226  16:49:07.954571 <... futex resumed>) = 0

unfinished表示系统调用未完成,后面肯定有一条resumed, Man中解释:

If a system call is being executed and meanwhile another one is being called from a different thread/process then strace will try to preserve the order of those events and mark the ongoing call
as being unfinished.  When the call returns it will be marked as resumed.

example futex:
1226  16:49:07.942938 futex(0x7a27d710, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>   -------- futex(0x7a27d710, FUTEX_WAIT_PRIVATE, 2) 未完成
1225  16:49:07.943089 futex(0x7a27d710, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>         -------- futex(0x7a27d710, FUTEX_WAKE_PRIVATE, 1) 未完成
1226  16:49:07.943253 <... futex resumed>) = 0                                         -------- futex WAIT完成,返回0  
1225  16:49:07.943357 <... futex resumed>) = 1                                         -------- futex WAKE完成,返回1, 表示只唤醒一个;
1226  16:49:07.943478 futex(0x7a27d710, FUTEX_WAKE_PRIVATE, 1) = 0                     -------- futex WAKE完成,返回0,无唤醒进程;
   
RETURN VALUE
       In  the  event  of an error, all operations return -1, and set errno to indicate the error.  The return value on success depends on the operation, as described in
       the following list:

       FUTEX_WAIT
              Returns 0 if the process was woken by a FUTEX_WAKE call.  See ERRORS for the various possible error returns.

       FUTEX_WAKE
              Returns the number of processes woken up.

1226  16:49:07.930478 futex(0x7a27d710, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource temporarily unavailable)

EAGAIN FUTEX_CMP_REQUEUE detected that the value pointed to by uaddr is not equal to the expected value val3.  (This probably  indicates  a  race;  use  the  safe  FUTEX_WAKE now.)

表示资源不可用,需要阻塞。
 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值