delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/10/12/05:09:55

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
X-ME-UUID: 20071012090920321 DOT 4E90A7000092 AT mwinf2a13 DOT orange DOT fr
Message-ID: <470F39C7.2010006@prologue.fr>
Date: Fri, 12 Oct 2007 11:09:27 +0200
From: patrick ficheux <pficheux AT prologue DOT fr>
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: shmget() returns xx if current user is not a administrator
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

In SANE (scanner project), the backend for snapscan failed to call 
shmget() with error EACCES (Permission denied) if the current user isn't 
administrator.
When I'am logged as windows administrator, shmget() is called successfully

In both case, the env. variable CYGWIN exists and this value is 
CYGWIN=server
cygserver is installed and runs


Is it possible to call shmget() without administrator's privileges ?
In this case, what kind of privileges a user must have ? and how to set 
those privileges ?

Thanks

extract from snapscan backend

#ifndef SHM_R
#define SHM_R 0
#endif

#ifndef SHM_W
#define SHM_W 0
#endif

struct urb_counters_t {
    unsigned long read_urbs;
    unsigned long write_urbs;
};

static struct urb_counters_t* urb_counters = NULL;

static SANE_Status snapscani_usb_shm_init(void)
{
    unsigned int shm_size = sizeof(struct urb_counters_t);
    void* shm_area = NULL;
    int shm_id = shmget (IPC_PRIVATE, shm_size, IPC_CREAT | SHM_R | SHM_W);
    if (shm_id == -1)
    {
        DBG ("snapscani_usb_shm_init: cannot create shared memory 
segment: %s\n",
            strerror (errno));
        return 1;
    }

a log from strace
   92   19220 [main] testshmget 2944 shmget: shmget (key = 0, size = 8, 
shmflg = 0x200)
 1627   20847 [main] testshmget 2944 shmat: shmat (shmid = 327680, 
shmaddr = 0x0, shmflg = 0x0)
  732   21579 [main] testshmget 2944 shmat: -1 [13] = shmat ()
   65   21644 [main] testshmget 2944 __set_errno: void* shmat(int, const 
void*, int):224 val 13



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019