~ubuntu-branches/debian/squeeze/nas/squeeze

« back to all changes in this revision

Viewing changes to server/os/osdep.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve McIntyre
  • Date: 2008-10-08 01:18:19 UTC
  • mfrom: (4.1.7 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081008011819-wmr4h2w0298k8t7z
Tags: 1.9.1-5
* Fix pending l10n issues. Debconf translations:
* Swedish. Closes: #491766 (thanks to brother@bsnet.se)
* Arabic. Closes: #500437 (thanks to Ossama Khayat)
* Basque. Closes: #500533 (thanks to Piarres Beobide)
* Brazilian Portuguese. Closes: #500973 (thanks to Felipe
  Augusto van de Wiel)
* Many thanks again to Christian Perrier for his i18n efforts,
  co-ordinating the above.

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
#include "dixstruct.h"
66
66
#endif /* AMOEBA */
67
67
 
68
 
#define BOTIMEOUT 200 /* in milliseconds */
 
68
#define BOTIMEOUT 200           /* in milliseconds */
69
69
#define BUFSIZE 4096
70
70
#define BUFWATERMARK 8192
71
71
#ifndef MAXBUFSIZE
72
72
#define MAXBUFSIZE (1 << 22)
73
73
#endif
74
74
 
75
 
#ifndef sgi         /* SGI defines OPEN_MAX in a useless way */
 
75
#ifndef sgi                     /* SGI defines OPEN_MAX in a useless way */
76
76
#ifndef X_NOT_POSIX
77
77
#ifdef _POSIX_SOURCE
78
78
#include <limits.h>
88
88
/*
89
89
 * Some fundamental constants
90
90
 */
91
 
#define CONNECTOR_STACK 4000    /* stack for connector task */
92
 
#define DEVREADER_STACK 4000    /* stack for device reader */
93
 
#define CREATOR_STACK   4000    /* stack for connection creator */
94
 
#define MAXTASKS        100     /* Maximum # clients */
 
91
#define CONNECTOR_STACK 4000    /* stack for connector task */
 
92
#define DEVREADER_STACK 4000    /* stack for device reader */
 
93
#define CREATOR_STACK   4000    /* stack for connection creator */
 
94
#define MAXTASKS        100     /* Maximum # clients */
95
95
 
96
96
/*
97
97
 * OsComm status bits
98
98
 */
99
 
#define CONN_KILLED     01      /* Connection being closed */
100
 
#define REQ_PUSHBACK    02      /* Request pushed back */
101
 
#define IGNORE          04      /* True if client ignored */
 
99
#define CONN_KILLED     01      /* Connection being closed */
 
100
#define REQ_PUSHBACK    02      /* Request pushed back */
 
101
#define IGNORE          04      /* True if client ignored */
102
102
#endif /* AMOEBA */
103
103
 
104
104
/*
137
137
 
138
138
#ifndef _MINIX
139
139
 
140
 
#define mskcnt ((MAXSOCKS + 31) / 32)   /* size of bit array */
 
140
#define mskcnt ((MAXSOCKS + 31) / 32)   /* size of bit array */
141
141
 
142
142
#if (mskcnt==1)
143
143
#define BITMASK(i) (1 << (i))
165
165
#define COPYBITS(src, dst) dst[0] = src[0]; dst[1] = src[1]
166
166
#define CLEARBITS(buf) buf[0] = 0; buf[1] = 0
167
167
#define MASKANDSETBITS(dst, b1, b2)  \
168
 
                      dst[0] = (b1[0] & b2[0]);\
169
 
                      dst[1] = (b1[1] & b2[1])
 
168
                      dst[0] = (b1[0] & b2[0]);\
 
169
                      dst[1] = (b1[1] & b2[1])
170
170
#define ORBITS(dst, b1, b2)  \
171
 
                      dst[0] = (b1[0] | b2[0]);\
172
 
                      dst[1] = (b1[1] | b2[1])
 
171
                      dst[0] = (b1[0] | b2[0]);\
 
172
                      dst[1] = (b1[1] | b2[1])
173
173
#define UNSETBITS(dst, b1) \
174
174
                      dst[0] &= ~b1[0]; \
175
175
                      dst[1] &= ~b1[1]
179
179
#define COPYBITS(src, dst) dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2];
180
180
#define CLEARBITS(buf) buf[0] = 0; buf[1] = 0; buf[2] = 0
181
181
#define MASKANDSETBITS(dst, b1, b2)  \
182
 
                      dst[0] = (b1[0] & b2[0]);\
183
 
                      dst[1] = (b1[1] & b2[1]);\
184
 
                      dst[2] = (b1[2] & b2[2])
 
182
                      dst[0] = (b1[0] & b2[0]);\
 
183
                      dst[1] = (b1[1] & b2[1]);\
 
184
                      dst[2] = (b1[2] & b2[2])
185
185
#define ORBITS(dst, b1, b2)  \
186
 
                      dst[0] = (b1[0] | b2[0]);\
187
 
                      dst[1] = (b1[1] | b2[1]);\
188
 
                      dst[2] = (b1[2] | b2[2])
 
186
                      dst[0] = (b1[0] | b2[0]);\
 
187
                      dst[1] = (b1[1] | b2[1]);\
 
188
                      dst[2] = (b1[2] | b2[2])
189
189
#define UNSETBITS(dst, b1) \
190
190
                      dst[0] &= ~b1[0]; \
191
191
                      dst[1] &= ~b1[1]; \
194
194
#endif
195
195
#if (mskcnt==4)
196
196
#define COPYBITS(src, dst) dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2];\
197
 
                      dst[3] = src[3]
 
197
                      dst[3] = src[3]
198
198
#define CLEARBITS(buf) buf[0] = 0; buf[1] = 0; buf[2] = 0; buf[3] = 0
199
199
#define MASKANDSETBITS(dst, b1, b2)  \
200
200
                      dst[0] = (b1[0] & b2[0]);\
216
216
 
217
217
#if (mskcnt>4)
218
218
#define COPYBITS(src, dst) bcopy((caddr_t) src, (caddr_t) dst,\
219
 
                                 mskcnt*sizeof(long))
 
219
                                 mskcnt*sizeof(long))
220
220
#define CLEARBITS(buf) bzero((caddr_t) buf, mskcnt*sizeof(long))
221
221
#define MASKANDSETBITS(dst, b1, b2)  \
222
 
                      { int cri;                        \
223
 
                        for (cri=mskcnt; --cri>=0; )    \
224
 
                          dst[cri] = (b1[cri] & b2[cri]); }
 
222
                      { int cri;                        \
 
223
                        for (cri=mskcnt; --cri>=0; )    \
 
224
                          dst[cri] = (b1[cri] & b2[cri]); }
225
225
#define ORBITS(dst, b1, b2)  \
226
 
                      { int cri;                        \
227
 
                      for (cri=mskcnt; --cri>=0; )      \
228
 
                          dst[cri] = (b1[cri] | b2[cri]); }
 
226
                      { int cri;                        \
 
227
                      for (cri=mskcnt; --cri>=0; )      \
 
228
                          dst[cri] = (b1[cri] | b2[cri]); }
229
229
#define UNSETBITS(dst, b1) \
230
 
                      { int cri;                        \
231
 
                      for (cri=mskcnt; --cri>=0; )      \
232
 
                          dst[cri] &= ~b1[cri];  }
 
230
                      { int cri;                        \
 
231
                      for (cri=mskcnt; --cri>=0; )      \
 
232
                          dst[cri] &= ~b1[cri];  }
233
233
#if (mskcnt==8)
234
234
#define ANYSET(src) (src[0] || src[1] || src[2] || src[3] || \
235
 
                     src[4] || src[5] || src[6] || src[7])
 
235
                     src[4] || src[5] || src[6] || src[7])
236
236
#endif
237
237
/*
238
238
 * If mskcnt>4 and not 8, then ANYSET is a routine defined in WaitFor.c.
247
247
    struct _connectionInput *next;
248
248
    char *buffer;               /* contains current client input */
249
249
    char *bufptr;               /* pointer to current start of data */
250
 
    int  bufcnt;                /* count of bytes in buffer */
 
250
    int bufcnt;                 /* count of bytes in buffer */
251
251
    int lenLastReq;
252
252
    int size;
253
253
} ConnectionInput, *ConnectionInputPtr;
263
263
 
264
264
#ifdef AMOEBA
265
265
typedef struct _amTcpIpComm {
266
 
    capability cap;             /* connection capability */
267
 
    struct circbuf *cb;         /* input buffer */
268
 
    signum signal;              /* signal to kill reader thread */
 
266
    capability cap;             /* connection capability */
 
267
    struct circbuf *cb;         /* input buffer */
 
268
    signum signal;              /* signal to kill reader thread */
269
269
} AmTcpIpCommRec;
270
270
#endif
271
271
 
272
 
 typedef struct _osComm {
 
272
typedef struct _osComm {
273
273
#ifndef AMOEBA
274
 
     int fd;
275
 
     ConnectionInputPtr input;
276
 
     ConnectionOutputPtr output;
 
274
    int fd;
 
275
    ConnectionInputPtr input;
 
276
    ConnectionOutputPtr output;
277
277
#ifdef _MINIX
278
278
    ConnectionInputPtr inputFake;
279
279
    ConnectionOutputPtr outputNext;
280
280
#endif
281
281
#else
282
 
    int         family;         /* connection family */
283
 
    int         number;         /* connection number */
284
 
    char        status;         /* connection status */
285
 
    int         size;           /* input buffer size */
286
 
    char        *buffer;        /* input buffer */
 
282
    int family;                 /* connection family */
 
283
    int number;                 /* connection number */
 
284
    char status;                /* connection status */
 
285
    int size;                   /* input buffer size */
 
286
    char *buffer;               /* input buffer */
287
287
    union {
288
 
        struct vc *vc;          /* virtual circuit */
289
 
        AmTcpIpCommRec tcp;     /* TCP/IP connection info */
 
288
        struct vc *vc;          /* virtual circuit */
 
289
        AmTcpIpCommRec tcp;     /* TCP/IP connection info */
290
290
    } conn;
291
291
#endif
292
 
     AuID       auth_id;                /* authorization id */
293
 
     long conn_time;            /* timestamp if not established, else 0  */
294
 
 } OsCommRec, *OsCommPtr;
 
292
    AuID auth_id;               /* authorization id */
 
293
    long conn_time;             /* timestamp if not established, else 0  */
 
294
} OsCommRec, *OsCommPtr;
295
295
 
296
296
#ifdef AMOEBA
297
297
#ifdef XDEBUG
298
 
extern Bool             amDebug;                /* amoeba debug toggle */
 
298
extern Bool amDebug;            /* amoeba debug toggle */
299
299
#endif /* XDEBUG */
300
 
extern char             *AuServerHostName;      /* audio server host name */
301
 
extern char             *AuTcpServerName;       /* TCP/IP server name */
302
 
extern ClientPtr        grabClient;             /* for grabs */
303
 
extern ClientPtr        Clients[MAXTASKS];      /* All clients */
304
 
extern int              maxClient;              /* Highest client# */
305
 
extern int              nNewConns;              /* # of new clients */
 
300
extern char *AuServerHostName;  /* audio server host name */
 
301
extern char *AuTcpServerName;   /* TCP/IP server name */
 
302
extern ClientPtr grabClient;    /* for grabs */
 
303
extern ClientPtr Clients[MAXTASKS];     /* All clients */
 
304
extern int maxClient;           /* Highest client# */
 
305
extern int nNewConns;           /* # of new clients */
306
306
 
307
 
extern semaphore        init_sema;              /* Initialize semaphore */
 
307
extern semaphore init_sema;     /* Initialize semaphore */
308
308
#endif /* AMOEBA */