Diff for /libaitsess/src/aitsess.c between versions 1.2.2.1 and 1.2.2.2

version 1.2.2.1, 2011/04/30 22:02:59 version 1.2.2.2, 2011/05/10 21:06:13
Line 59  char sessError[MAX_STR + 1]; Line 59  char sessError[MAX_STR + 1];
 // Error maintenance functions ...  // Error maintenance functions ...
   
 // sess_GetErrno() Get error code of last operation  // sess_GetErrno() Get error code of last operation
inline int sess_GetErrno()inline int
 sess_GetErrno()
 {  {
         return sessErrno;          return sessErrno;
 }  }
 // sess_GetError() Get error text of last operation  // sess_GetError() Get error text of last operation
inline const char *sess_GetError()inline const char *
 sess_GetError()
 {  {
         return sessError;          return sessError;
 }  }
 // sessDbg() Debug/Logging operations  // sessDbg() Debug/Logging operations
static inline int sessDbg(FILE *f, char *fmt, ...)static inline int
 sessDbg(FILE *f, char *fmt, ...)
 {  {
         int ret = 0;          int ret = 0;
         va_list lst;          va_list lst;
Line 90  static inline int sessDbg(FILE *f, char *fmt, ...) Line 93  static inline int sessDbg(FILE *f, char *fmt, ...)
  * @Sess = Session item   * @Sess = Session item
  * return: 0 OK new key created, -1 error: no memory or file not created, 1 OK key finded   * return: 0 OK new key created, -1 error: no memory or file not created, 1 OK key finded
 */  */
inline int initSession(const int cnID, const char *csFName, tagSess ** __restrict Sess)inline int
 initSession(const int cnID, const char *csFName, tagSess ** __restrict Sess)
 {  {
         int h, ret = 0;          int h, ret = 0;
         char szStr[MAX_STR + 1];          char szStr[MAX_STR + 1];
Line 146  inline int initSession(const int cnID, const char *csF Line 150  inline int initSession(const int cnID, const char *csF
  * @csFName = Session filename for delete, if NULL nothing delete   * @csFName = Session filename for delete, if NULL nothing delete
  * @Sess = Session item   * @Sess = Session item
 */  */
inline void freeSession(const char *csFName, tagSess ** __restrict Sess)inline void
 freeSession(const char *csFName, tagSess ** __restrict Sess)
 {  {
         (*Sess)->type ^= (*Sess)->type;          (*Sess)->type ^= (*Sess)->type;
         if (csFName)          if (csFName)
Line 165  inline void freeSession(const char *csFName, tagSess * Line 170  inline void freeSession(const char *csFName, tagSess *
  * @Sess = Session item   * @Sess = Session item
  * return: 0 Ok successful, -1 error: not allocated resources   * return: 0 Ok successful, -1 error: not allocated resources
 */  */
int map_createSession(const char *csFName, const int cnSeed, const u_int cnSize, tagSess ** __restrict Sess)int
 map_createSession(const char *csFName, const int cnSeed, const u_int cnSize, tagSess ** __restrict Sess)
 {  {
         int ret = 0;          int ret = 0;
         char szSName[2][FILENAME_MAX + 1];          char szSName[2][FILENAME_MAX + 1];
Line 240  int map_createSession(const char *csFName, const int c Line 246  int map_createSession(const char *csFName, const int c
  * @csFName = Session name for delete   * @csFName = Session name for delete
  * @Sess = Session item   * @Sess = Session item
 */  */
void map_destroySession(const char *csFName, tagSess ** __restrict Sess)void
 map_destroySession(const char *csFName, tagSess ** __restrict Sess)
 {  {
         int flg = 1;          int flg = 1;
         char szSName[2][FILENAME_MAX + 1];          char szSName[2][FILENAME_MAX + 1];
Line 279  void map_destroySession(const char *csFName, tagSess * Line 286  void map_destroySession(const char *csFName, tagSess *
  * @Sess = Session item   * @Sess = Session item
  * return: 0 Ok successful, -1 error: not allocated resources   * return: 0 Ok successful, -1 error: not allocated resources
 */  */
int ipc_createSession(const char *csFName, const int cnSeed, const u_int cnSize, tagSess ** __restrict Sess)int
 ipc_createSession(const char *csFName, const int cnSeed, const u_int cnSize, tagSess ** __restrict Sess)
 {  {
         int ret = 0;          int ret = 0;
         union semun sems;          union semun sems;
Line 330  int ipc_createSession(const char *csFName, const int c Line 338  int ipc_createSession(const char *csFName, const int c
  * @csFName = Session name for delete   * @csFName = Session name for delete
  * @Sess = Session item   * @Sess = Session item
 */  */
void ipc_destroySession(const char *csFName, tagSess ** __restrict Sess)void
 ipc_destroySession(const char *csFName, tagSess ** __restrict Sess)
 {  {
         int flg = 1;          int flg = 1;
         union semun sems;          union semun sems;
Line 357  void ipc_destroySession(const char *csFName, tagSess * Line 366  void ipc_destroySession(const char *csFName, tagSess *
  * @procMem = Custom start address (optionl) *default must be 0*   * @procMem = Custom start address (optionl) *default must be 0*
  * return: NULL failed attach, !=NULL begin address of memory   * return: NULL failed attach, !=NULL begin address of memory
 */  */
inline void *map_attachSession(tagSess * __restrict s, void *procMem)inline void *
 map_attachSession(tagSess * __restrict s, void *procMem)
 {  {
         struct stat sb;          struct stat sb;
   
Line 386  inline void *map_attachSession(tagSess * __restrict s, Line 396  inline void *map_attachSession(tagSess * __restrict s,
  * map_detachSession() MMAP Detach from shared memory   * map_detachSession() MMAP Detach from shared memory
  * @s = Session item   * @s = Session item
 */  */
inline void map_detachSession(tagSess * __restrict s)inline void
 map_detachSession(tagSess * __restrict s)
 {  {
         if (!s)          if (!s)
                 return;                  return;
Line 405  inline void map_detachSession(tagSess * __restrict s) Line 416  inline void map_detachSession(tagSess * __restrict s)
  * @procMem = Custom start address (optionl) *default must be 0*   * @procMem = Custom start address (optionl) *default must be 0*
  * return: NULL failed attach, !=NULL begin address of memory   * return: NULL failed attach, !=NULL begin address of memory
 */  */
inline void *ipc_attachSession(tagSess * __restrict s, void *procMem)inline void *
 ipc_attachSession(tagSess * __restrict s, void *procMem)
 {  {
         if (!s)          if (!s)
                 return NULL;                  return NULL;
Line 423  inline void *ipc_attachSession(tagSess * __restrict s, Line 435  inline void *ipc_attachSession(tagSess * __restrict s,
  * ipc_detachSession() IPC Detach from shared memory   * ipc_detachSession() IPC Detach from shared memory
  * @s = Session item   * @s = Session item
 */  */
inline void ipc_detachSession(tagSess * __restrict s)inline void
 ipc_detachSession(tagSess * __restrict s)
 {  {
         if (!s)          if (!s)
                 return;                  return;
Line 439  inline void ipc_detachSession(tagSess * __restrict s) Line 452  inline void ipc_detachSession(tagSess * __restrict s)
  * @s = Session item   * @s = Session item
  * return: -1 null session item, 0 not attached, 1 attached memory   * return: -1 null session item, 0 not attached, 1 attached memory
 */  */
inline int isAttached(tagSess * __restrict s)inline int
 isAttached(tagSess * __restrict s)
 {  {
         if (!s)          if (!s)
                 return -1;                  return -1;
Line 452  inline int isAttached(tagSess * __restrict s) Line 466  inline int isAttached(tagSess * __restrict s)
  * map_notSemaphore() MMAP negative block if semaphore isn`t signaled   * map_notSemaphore() MMAP negative block if semaphore isn`t signaled
  * @s = Session item   * @s = Session item
 */  */
inline void map_notSemaphore(tagSess * __restrict s)inline void
 map_notSemaphore(tagSess * __restrict s)
 {  {
         int i = -1;          int i = -1;
   
Line 469  inline void map_notSemaphore(tagSess * __restrict s) Line 484  inline void map_notSemaphore(tagSess * __restrict s)
  * @s = Session item   * @s = Session item
  * return: -1 error: can`t return semaphore, 0 = false, 1 = true   * return: -1 error: can`t return semaphore, 0 = false, 1 = true
 */  */
inline int map_isSemaphored(tagSess * __restrict s)inline int
 map_isSemaphored(tagSess * __restrict s)
 {  {
         int val = -1;          int val = -1;
   
Line 485  inline int map_isSemaphored(tagSess * __restrict s) Line 501  inline int map_isSemaphored(tagSess * __restrict s)
  * @s = Session item   * @s = Session item
  * return: 0 Ok, -1 error: can`t increment    * return: 0 Ok, -1 error: can`t increment 
 */  */
inline int map_addSemaphore(tagSess * __restrict s)inline int
 map_addSemaphore(tagSess * __restrict s)
 {  {
         if (!s)          if (!s)
                 return -1;                  return -1;
Line 498  inline int map_addSemaphore(tagSess * __restrict s) Line 515  inline int map_addSemaphore(tagSess * __restrict s)
  * @s = Session item   * @s = Session item
  * return: 0 Ok, -1 error: can`t decrement    * return: 0 Ok, -1 error: can`t decrement 
 */  */
inline int map_decSemaphore(tagSess * __restrict s)inline int
 map_decSemaphore(tagSess * __restrict s)
 {  {
         if (!s)          if (!s)
                 return -1;                  return -1;
Line 510  inline int map_decSemaphore(tagSess * __restrict s) Line 528  inline int map_decSemaphore(tagSess * __restrict s)
  * ipc_notSemaphore() IPC negative block if semaphore isn`t signaled   * ipc_notSemaphore() IPC negative block if semaphore isn`t signaled
  * @s = Session item   * @s = Session item
 */  */
inline void ipc_notSemaphore(tagSess * __restrict s)inline void
 ipc_notSemaphore(tagSess * __restrict s)
 {  {
         struct sembuf sb = { 0, 0, 0 };          struct sembuf sb = { 0, 0, 0 };
   
Line 523  inline void ipc_notSemaphore(tagSess * __restrict s) Line 542  inline void ipc_notSemaphore(tagSess * __restrict s)
  * @s = Session item   * @s = Session item
  * return: -1 error: can`t return semaphore, 0 = false, 1 = true   * return: -1 error: can`t return semaphore, 0 = false, 1 = true
 */  */
inline int ipc_isSemaphored(tagSess * __restrict s)inline int
 ipc_isSemaphored(tagSess * __restrict s)
 {  {
         struct sembuf sb = { 0, 0, IPC_NOWAIT };          struct sembuf sb = { 0, 0, IPC_NOWAIT };
   
Line 538  inline int ipc_isSemaphored(tagSess * __restrict s) Line 558  inline int ipc_isSemaphored(tagSess * __restrict s)
  * @s = Session item   * @s = Session item
  * return: 0 Ok, -1 error: can`t increment    * return: 0 Ok, -1 error: can`t increment 
 */  */
inline int ipc_addSemaphore(tagSess * __restrict s)inline int
 ipc_addSemaphore(tagSess * __restrict s)
 {  {
         struct sembuf sb = { 0, 1, 0 };          struct sembuf sb = { 0, 1, 0 };
   
Line 553  inline int ipc_addSemaphore(tagSess * __restrict s) Line 574  inline int ipc_addSemaphore(tagSess * __restrict s)
  * @s = Session item   * @s = Session item
  * return: 0 Ok, -1 error: can`t decrement    * return: 0 Ok, -1 error: can`t decrement 
 */  */
inline int ipc_decSemaphore(tagSess * __restrict s)inline int
 ipc_decSemaphore(tagSess * __restrict s)
 {  {
         struct sembuf sb = { 0, -1, 0 };          struct sembuf sb = { 0, -1, 0 };
   

Removed from v.1.2.2.1  
changed lines
  Added in v.1.2.2.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>