TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Dave Kelly
from: Bill Birrell
date: 1999-01-04 11:58:00
subject: help needed

Hi Dave,

 > Where/how would be the best way to flesh out this
 > structure to make
 > it end on an 8 byte boundry?

    Try this:-
--------------------------------------------------------
/*
On my system 'u_int32' is unsigned long or 4 bytes.
*/
#define u_int32 unsigned long

/* needed to define otherwise undefined procid */
typedef union {
    unsigned long ul;
    unsigned int ui;
    }
    procid;

/* Semaphore structure definition */
typedef struct semaphore  {
    u_int32
        s_value,        /* semaphore value (free/busy satus) */
        s_lock;         /* semaphore structure lock (use count) */
    procid
        *s_qnext,       /* wait queue for process descriptors */
        *s_qprev;       /* wait queue for process descriptors */
    u_int32
        s_length,       /* current length of wait queue */
        s_owner,        /* current owner of semphore */
        s_user,         /* reserved for users        */
        s_flags,        /* general purpose bit-field flags */
        s_sync,         /* integrity sync code */
        s_reserved[3];  /* reserved for system use */
} semaphore, *Semaphore;
#include 
int main(void)
{   struct semaphore n;
    return printf("%d\n",sizeof(n));
}

--------------------------------------------------------
 > One other note, this a header that services a system
 > call _getsys().

    Since this will return 44 or 48 depending whether s_qnext and s_qprev
are 32bit or 16bit addresses (pointers), your arithmetic would benefit from
checking, Dave.

Best wishes,
Bill.

---
* Origin: Meerkats Anonymous (2:2504/200)
SEEN-BY: 396/1 632/0 371 633/260 262 267 270 371 634/397 635/506 728 639/252
SEEN-BY: 670/218
@PATH: 2504/200 213 255/3 1 251/25 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.