X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/e845327014553b45bf92daa2dd1227cf516df05e..2d5cbf27a14bdea97b5c3098550818bb983da42f:/usr/src/include/struct.h diff --git a/usr/src/include/struct.h b/usr/src/include/struct.h index 2486388218..f649dff9d7 100644 --- a/usr/src/include/struct.h +++ b/usr/src/include/struct.h @@ -1,9 +1,25 @@ -/* struct.h 4.1 83/05/03 */ - -/* - * access to information relating to the fields of a structure +/*- + * Copyright (c) 1983 The Regents of the University of California. + * All rights reserved. + * + * %sccs.include.redist.c% + * + * @(#)struct.h 5.2 (Berkeley) %G% */ -#define fldoff(str, fld) ((int)&(((struct str *)0)->fld)) -#define fldsiz(str, fld) (sizeof(((struct str *)0)->fld)) -#define strbase(str, ptr, fld) ((struct str *)((char *)(ptr)-fldoff(str, fld))) +#ifndef _STRUCT_H_ +#define _STRUCT_H_ + +/* Offset of the field in the structure. */ +#define fldoff(name, field) \ + ((int)&(((struct name *)0)->field)) + +/* Size of the field in the structure. */ +#define fldsiz(name, field) \ + (sizeof(((struct name *)0)->field)) + +/* Address of the structure from a field. */ +#define strbase(name, addr, field) \ + ((struct name *)((char *)(addr) - fldoff(name, field))) + +#endif /* !_STRUCT_H_ */