Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7837375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:36:49+00:00 2026-06-02T14:36:49+00:00

I tried to set the size of a POSIX message queue and do not

  • 0

I tried to set the size of a POSIX message queue and do not seem to be permitted.

The msgctl() man page states:

IPC_SET can only be executed by a process with appropriate privileges
or that has an effective user ID equal to the value of
msg_perm.cuid or msg_perm.uid in the msqid_ds data structure
associated with msqid. Only a process with appropriate privileges can
raise the value of msg_qbytes.

The following test program returns:

uid: 1324
effective uid: 1324
msgctl(msqid=8028175, IPC_SET, ...) failed 
(msg_perm.uid=1324,msg_perm.cuid=1324): Operation not permitted (errno=1)

#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/msg.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>

int main(int iArgC, char ** ppszArgv)
{
  printf("uid: %u\n", getuid());
  printf("effective uid: %u\n", geteuid());

  int msqid = msgget(
    IPC_PRIVATE,
    IPC_CREAT |
    S_IRGRP | S_IWGRP |
    S_IRUSR | S_IWUSR |
    S_IROTH | S_IWOTH);

  if (0 > msqid)
  {
    fprintf(stderr,
        "msgget() failed.\n");
    return EXIT_FAILURE;
  }

  {
    struct msqid_ds ds = {0};

    if (msgctl(
        msqid,
        IPC_STAT,
        &ds))
    {
      fprintf(stderr,
          "msgctl(msqid=%d, IPC_STAT, ...) failed: "
          "%s (errno=%d)\n",
          msqid,
          strerror(errno),
          errno);

      return EXIT_FAILURE;
    }

    ds.msg_qbytes = 1024*1024;

    if (msgctl(
        msqid,
        IPC_SET,
        &ds))
    {
      fprintf(stderr,
          "msgctl(msqid=%d, IPC_SET, ...) failed "
          "(msg_perm.uid=%u,"
          "msg_perm.cuid=%u): "
          "%s (errno=%d)\n",
          msqid,
          ds.msg_perm.uid,
          ds.msg_perm.cuid,
          strerror(errno),
          errno);
    }

    return EXIT_FAILURE;
  }

  return EXIT_SUCCESS;
}

/* EOF */

So, what’s the trick?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T14:36:50+00:00Added an answer on June 2, 2026 at 2:36 pm

    From man msgctl:

    Appropriate privilege (Linux: the CAP_IPC_RESOURCE capability) is required to raise the msg_qbytes value beyond the system parameter MSGMNB.

    On my system, MSGNMB is 16 kB which is well below the 1 MB you try to set it to. Have you checked this limit? (Do cat /proc/sys/kernel/msgmnb)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've tried to set the margin and border to 0,but still not working. <style
I tried to set the dbms_output size to unlimited inside a stored procedure. But
I'm trying to set the font size of a table cell, but its not
I tried to set the tick style to tsManual, the min and max position
I tried to set the background color of a data grid view to be
I tried to set the usergent using Inet1.Execute , GET, Referer: yahoo.com & vbCrLf
I tried to set up the date_select in my HAML template for displaying just
I tried to set up my togglebutton properties layout using style.xml. Here's my code:
I need to set -Dfile.encoding=UTF8 globally on Windows machine. I tried to set JAVA_OPTS
I want to achieve this using html and css: I have tried to set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.