From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII X-Google-Thread: f8c9b,1d64a7fe5aec5d17 X-Google-Attributes: gidf8c9b,public X-Google-Thread: fee84,1d64a7fe5aec5d17 X-Google-Attributes: gidfee84,public From: sajjad@uic.edu (Sajjad Lateef) Subject: Re: POSIX.4 Semaphore questions Date: 1997/11/19 Message-ID: <64ti0k$3frk$1@piglet.cc.uic.edu>#1/1 X-Deja-AN: 290674710 References: <3471B707.77EA@us.ibm.com> Followup-To: comp.unix.questions,comp.unix.osf.osf1 Organization: University of Illinois at Chicago Newsgroups: comp.unix.questions,comp.unix.osf.osf1 Hi, Terrence Chan in "UNIX System Programming using C++" mentions using RWX permissions for the user only in the an example. I could not find a detailed explanation. If the file paradigm for POSIX semaphores was taken a step beyond the semaphore naming convention, it would not be too wrong to assume that permissions would affect the semaphore (or IPC) as they do files. I would imagine that your second call to sem_open would fail. It might be easiest to write a small program and test it out. (Which OS are you using? Solaris 2.6? Unfortunately I do not have access to any system that support POSIX IPCs) Question: o Chan uses S_IRWXU to specify 0600 permissions. Is it suggested to use the mnemonic instead of the numbers? (S_IRWU|S_IRG|S_IRO == 0644) Thanks, Sajjad r H����������� Scott Moore (samoore@us.ibm.com) wrote: : Hello- : I am new to using POSIX.4 semaphores, and I can not find any : documentation about how permissions are used. I know that on the : sem_open(), if the caller has O_CREAT in the flags and a semaphore is : created, permissions are set to the values specified by the mode : parameter. : What I don't get is what the permissions mean. Is it possible to have : the permissions 0604 or 0602? In other words, does it make sense to : have Read only (or write only) permissions to a POSIX semaphore? The : reason I ask this is because System V semaphores this makes sense, but I : am not sure of the POSIX implementation. : If this is valid input on the sem_open, let's say that user A creates a : named semaphore: : sem_t semPtr = sem_open("/mysem", O_CREATE | O_EXCL, 0604, 0); : And user B accesses the semaphore with: : sem_t semPtr = sem_open("/mysem", 0); : Would this fail for user B? Do you need both read and write access to : get the semaphore? : Thank you for any input! : Scott