This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

shmget() returns xx if current user is not a administrator


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]