BSD 4_1_snap development
[unix-history] / sys / h / inline.h
CommitLineData
6bafdb92
C
1/* inline.h 4.3 81/02/26 */
2/*
3 * Definitions of inlines, and macro replacements
4 * for them if UNFAST (latter only scantily tested).
5 */
6
7#ifndef UNFAST
8
9#define plock(ip) \
10{ \
11 while ((ip)->i_flag & ILOCK) { \
12 (ip)->i_flag |= IWANT; \
13 sleep((caddr_t)(ip), PINOD); \
14 } \
15 (ip)->i_flag |= ILOCK; \
16}
17
18#define prele(ip) \
19{ \
20 (ip)->i_flag &= ~ILOCK; \
21 if ((ip)->i_flag&IWANT) { \
22 (ip)->i_flag &= ~IWANT; \
23 wakeup((caddr_t)(ip)); \
24 } \
25}
26
27#define GETF(fp, fd) { \
28 if ((unsigned)(fd) >= NOFILE || ((fp) = u.u_ofile[fd]) == NULL) { \
29 u.u_error = EBADF; \
30 return; \
31 } \
32}
33
34#define IUPDAT(ip, t1, t2, waitfor) { \
35 if (ip->i_flag&(IUPD|IACC|ICHG)) \
36 iupdat(ip, t1, t2, waitfor); \
37}
38#define ISSIG(p) ((p)->p_sig && \
39 ((p)->p_flag&STRC || ((p)->p_sig &~ (p)->p_ignsig)) && issig())
40#else
41
42#define GETF(fp, fd) { \
43 (fp) = getf(fd); \
44 if ((fp) == NULL) \
45 return; \
46}
47
48#define IUPDAT(ip, t1, t2, waitfor) iupdat(ip, t1, t2, waitfor)
49
50#define ISSIG(p) issig(p)
51#endif