11

I'm using Linux POSIX mqueue implementation, and I have a problem. For current kernel, the max message size is 1MB, but I need to have no limit.

man mq_overview says that if the process is privileged (a process that has CAP_SYS_RESOURCE capability) it has no limits. I thought that a process executed by root was already privileged, but I'm still getting "message too long" error (my message has 2MB).

How can I add CAP_SYS_RESOURCE capability to the process?

Melebius
  • 6,183
  • 4
  • 39
  • 52
Leonardo Alt
  • 325
  • 3
  • 9

3 Answers3

7

I don't know if it is possible to set it to a running process (I guess not) but you can grant the CAP_SYS_RESOURCE capability to an executable file using # setcap 'CAP_SYS_RESOURCE=+ep' /path/to/executable (as super user). In this example the +ep turns down into raise the CAP_SYS_RESOURCE capibility to be permitted and effective. However the man pages capabilities(7) and setcap(8) are useful sources for further information.

coltox
  • 360
  • 3
  • 8
3

you can change the ceiling on the maximum message size on this file /proc/sys/fs/mqueue/msgsize_max I hope it works

Phuc Vinh
  • 31
  • 2
1

try the option RLIMIT_MSGQUEUE in function: int setrlimit(int resource, const struct rlimit *rlim);

man page: http://www.kernel.org/doc/man-pages/online/pages/man2/setrlimit.2.html

:)