cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Potential Fix to curl 7.28.1 for HPUX 11.11 CC compiler </usr/include/sys/rw_lock.h> compiler error

From: Frank Chang <frank_chang91_at_hotmail.com>
Date: Wed, 12 Dec 2012 05:22:10 -0500

Dan Fandrich, Thank you for you reply. Here is the /usr/include/sys/rw_lock..file for HPUX 11.11 for your potential review if you have the time. The offending lines are around line 169. You may contact me at frank_chang91_at_hotmail.com or frankchang91_at_gmail.com if you have any questions. Thank you for all of your help the past week and half.
 
/* @(#) rw_lock.h $Date: 2001/02/02 16:37:40 $Revision: r11.11/1 PATCH_11.11 (PHKL_23302)
*/
/*
 * BEGIN_DESC
 *
 * File:
 * common/sys/rw_lock.h
 *
 * Purpose:
 * Header file for kernel read-write locks implemented in sys/rw_lock.c.
 * The HP-UX read-write locks were ported (with some modifications)
 * from OSF/1, hence all the copyrights from the OSF/1 code.
 *
 * Classification: Release to Release Consistency Req:
 * <<please select one of the following:>>
 * kernel subsystem private none
 * kernel private none
 * kernel 3rd party private limited source
 * public binary & source
 *
 * BE header: yes
 *
 * Shipped: yes
 * /usr/include/sys/rw_lock.h
 * /usr/conf/sys/rw_lock.h
 *
 * <<please delete the following note if this is a "public" header>>
 * NOTE:
 * This header file contains information specific to the internals
 * of the HP-UX implementation. The contents of this header file
 * are subject to change without notice. Such changes may affect
 * source code, object code, or binary compatibility between
 * releases of HP-UX. Code which uses the symbols contained within
 * this header file is inherently non-portable (even between HP-UX
 * implementations).
 *
 * END_DESC
*/
/*
 * Copyright (c) 1990, OPEN SOFTWARE FOUNDATION, INC.
 * Copyright (c) 1987,1988,1989 Carnegie-Mellon University
 * Copyright (c) 1988,1989 Encore Computer Corporation.
 * Copyright (c) 1985, Avadis Tevanian, Jr., Michael Wayne Young
 */

#ifndef _RW_LOCK_INCLUDED
#define _RW_LOCK_INCLUDED
#include <sys/spinlock.h>
#include <sys/sem_utl.h>
#include <sys/types.h>
#ifdef SEMAPHORE_DEBUG
#define MACH_LTRACKS
#define LOCK_STATS
#endif /* SEMAPHORE_DEBUG */
#define read_lock_held(_lock) (owns_rw_lock(_lock) && (_lock)->read_count)
#define write_lock_held(_lock) (owns_rw_lock(_lock) && !(_lock)->read_count \
     && ((_lock)->want_write || (_lock)->want_upgrade))
#define lock_held(_lock) (read_lock_held(_lock) || write_lock_held(_lock))
struct rw_lock {
   lock_t *interlock; /* Spinlock for accessing rw_lock struct */
   unsigned int delay; /* Delay flag, <> 0 delays before block */
   unsigned int write_waiters; /* Write-request sleepers count */
   volatile int read_count; /* Read access count */
   volatile char want_write; /* kthread has or wants write access */
   volatile char want_upgrade; /* kthread has or wants upgrade */
   char waiting; /* kthread waiting for some access */
   char rwl_flags; /* kthread non-swappable while lock
          * held flag or prio ceiling to be done
         * flag
         */
   struct kthread *l_kthread; /* Last kthread to acquire lock */
#ifdef SEMAPHORE_DEBUG
   unsigned short order; /* Order for deadlock avoidance checks */
   char *name; /* Name associated with lock */
   unsigned char deadlock_safe; /* Flag indiacates if deadlock safe order */
#endif /* SEMAPHORE_DEBUG */
#ifdef MACH_LTRACKS
   uintptr_t lck_addr; /* RP of last caller to acquire lock */
   uintptr_t unlck_addr; /* RP of last caller to release lock */
#endif /* MACH_LTRACKS */
#ifdef LOCK_STATS
   unsigned int write_tries; /* lock_write() calls */
   unsigned int write_flag_waits; /* " wait to get want_write flag */
   unsigned int write_flag_rewaits; /* " lost race to get want_write flag */
   unsigned int write_waits; /* " wait for write access */
   unsigned int write_rewaits; /* " lost race to get write access */
   unsigned int read_tries; /* lock_read() calls */
   unsigned int read_waits; /* " wait for read access */
   unsigned int read_rewaits; /* " lost race to get read access */
   unsigned int write_cond_tries; /* lock_try_write() calls */
   unsigned int write_cond_fails; /* " failed */
   unsigned int read_cond_tries; /* lock_try_read() calls */
   unsigned int read_cond_fails; /* " failed */
   unsigned int upgrade_tries; /* lock_(try_)read_to_write() calls */
   unsigned int upgrade_fails; /* " failed */
   unsigned int upgrade_waits; /* " wait for upgrade access */
   unsigned int upgrade_rewaits; /* " lost race to get upgrade access */
   unsigned long lock_wait_min; /* Longest time blocked on lock */
   unsigned long lock_wait_max; /* Longest time blocked on lock */
   unsigned long lock_wait_sum[2]; /* Total time blocked on lock */
   unsigned int lock_max_reads; /* Maximum number of active readers */
#endif /* LOCK_STATS */
};
#define _RWLOCK_T
typedef struct rw_lock rw_lock_data_t;
typedef struct rw_lock *rw_lock_t;
typedef void *rw_lock_key_t; /* Opaque type to match disown/claim */
#define RW_NO_DELAY 0x0
#define RW_DELAY 0xffffffff
/*
 * Flags for what process(es) are waiting (blocked) on.
 */
#define RW_WRITE_QUEUE 0x1
#define RW_WRITE_LOCK 0x2
#define RW_UPGRADE_LOCK 0x4
#define RW_READ_LOCK 0x8
#define MAX_RW_LOCK 64
extern void lock_init3 __((rw_lock_t,char,unsigned int,char,int,char*));
extern void lock_write __((rw_lock_t));
extern void lock_read __((rw_lock_t));
extern void lock_done __((rw_lock_t));
extern int lock_read_to_write __((rw_lock_t));
extern void lock_write_to_read __((rw_lock_t));
extern int lock_try_write __((rw_lock_t));
extern rw_lock_key_t lock_disown __((rw_lock_t, rw_lock_key_t));
extern void lock_claim __((rw_lock_t, rw_lock_key_t));
extern void rw_lock_initialize __((void));
extern void rwlock_init4 __((rw_lock_t,unsigned int,int,int,char*));

/* #ifdef notdef */
/*
 * Not supported in HP-UX
 */
extern int lock_try_read __((rw_lock_t));
extern int lock_try_read_to_write __((rw_lock_t));
/* #endif */ /* notdef */
#define lock_read_done(l) lock_done(l)
#define lock_write_done(l) lock_done(l)
/*
 * For source compatibility, need to continue defining TRUE and FALSE for
 * user-level applications. Although this file defines a kernel only service,
 * some user-level applications are indirectly including this file and
 * depending on the defines for TRUE and FALSE. These defines need to
 * remain until all the user-level issues have been handled.
 */
#ifndef _KERNEL
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#else
#if ((TRUE != 1) || (FALSE != 0))
This is probably not a good thing....
#endif
#endif /* !TRUE */
#endif /* !_KERNEL */

#define RWLCK_SUCCESS 1
#define RWLCK_FAILURE 0
#define RWLCK_SLEEP 0x01 /* Obsolete , used for old lock_init3() */

#define RWLCK_NOSWAP 0x01
#define RWLCK_PRIOCEIL 0x02
#define RWLCK_CANSLEEP 0x04
#define RWLCK_CANDISOWN 0x08
#define RWLCK_ALLFLAGS (RWLCK_NOSWAP|RWLCK_PRIOCEIL| \
    RWLCK_CANSLEEP|RWLCK_CANDISOWN)
#endif /* _RW_LOCK_INCLUDED */

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-12-12