linux普通用户发送信号,linux – 是否可以向属于不同用户的进程发送信号?

我需要向不同的进程发送信号以进行一些实时通信,但是该进程属于不同的用户.

例如

PID user group

1234 foo foobar

4321 bar foobar

我希望进程1234和4321能够相互发送信号吗?

如果我使用套接字或管道,我可以将它们的掩码设置为rw-rw-r–并且通信可以正常工作.但是我需要使用信号进行通信(普通或实时,不重要).

有办法吗?

解决方法:

引用来自kill(2):

For a process to have permission to send a signal it must either be privileged

(under Linux: have the CAP_KILL capability), or the real or effective user ID

of the sending process must equal the real or saved set-user-ID of the target

process. In the case of SIGCONT it suffices when the sending and receiving

processes belong to the same session.

您可以找到有用的功能(7)和setcap(8).

标签:linux,posix,signals

来源: https://codeday.me/bug/20190826/1725592.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值