posix
Class SemSet

java.lang.Object
  extended by posix.IPC
      extended by posix.SemSet

public class SemSet
extends IPC

Represent a posix semaphore set. Work in progress.


Nested Class Summary
static class SemSet.semid_ds
           
 
Nested classes/interfaces inherited from class posix.IPC
IPC.Perm
 
Field Summary
static short SEM_UNDO
           
 
Fields inherited from class posix.IPC
egid, euid, id, IPC_ALLOC, IPC_CI, IPC_CREAT, IPC_EXCL, IPC_NOCLEAR, IPC_NOWAIT, IPC_PHYS, IPC_PRIVATE, owner, pid
 
Constructor Summary
SemSet(int qid)
          Attach to an existing semaphore set
SemSet(int key, int nsem, int flag)
           
SemSet(String path, int id)
          Attach to an existing semaphore set
 
Method Summary
 char getNCnt(char semnum)
           
 int getPid(char semnum)
           
 SemSet.semid_ds getStatus()
          Return the permissions for this IPC data structure.
 short getValue(char semnum)
           
 short[] getValues()
           
 char getZCnt(char semnum)
           
 void remove()
          Remove this IPC data structure from the system.
static int semget(int key, int num, int flag)
           
 void semop(short[] sema)
           
 void setPerm(IPC.Perm st)
          Set the uid, gid, mode, qbytes for this IPC data structure.
 void setValue(char semnum, short val)
           
 void setValues(short[] vals)
           
 
Methods inherited from class posix.IPC
dispose, finalize, ftok, getId, getPerm, isPidValid, setPerm
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEM_UNDO

public static final short SEM_UNDO
Constructor Detail

SemSet

public SemSet(int key,
              int nsem,
              int flag)
       throws IPCException
Throws:
IPCException

SemSet

public SemSet(int qid)
       throws IPCException
Attach to an existing semaphore set

Throws:
IPCException

SemSet

public SemSet(String path,
              int id)
       throws IPCException
Attach to an existing semaphore set

Throws:
IPCException
Method Detail

remove

public void remove()
Description copied from class: IPC
Remove this IPC data structure from the system.

Specified by:
remove in class IPC

semget

public static int semget(int key,
                         int num,
                         int flag)

getStatus

public SemSet.semid_ds getStatus()
                          throws IPCException
Description copied from class: IPC
Return the permissions for this IPC data structure.

Specified by:
getStatus in class IPC
Throws:
IPCException

setPerm

public void setPerm(IPC.Perm st)
             throws IPCException
Set the uid, gid, mode, qbytes for this IPC data structure. Only a process with appropriate privileges can raise the value of msg_qbytes.

Specified by:
setPerm in class IPC
Parameters:
st - a current msqid_ds obtained from getStatus()
Throws:
IPCException

semop

public void semop(short[] sema)
           throws IPCException
Throws:
IPCException

getPid

public int getPid(char semnum)
           throws IPCException
Throws:
IPCException

getNCnt

public char getNCnt(char semnum)
             throws IPCException
Throws:
IPCException

getZCnt

public char getZCnt(char semnum)
             throws IPCException
Throws:
IPCException

getValue

public short getValue(char semnum)
               throws IPCException
Throws:
IPCException

setValue

public void setValue(char semnum,
                     short val)
              throws IPCException
Throws:
IPCException

getValues

public short[] getValues()
                  throws IPCException
Throws:
IPCException

setValues

public void setValues(short[] vals)
               throws IPCException
Throws:
IPCException