~ubuntu-branches/ubuntu/raring/binkd/raring

« back to all changes in this revision

Viewing changes to sys.h

  • Committer: Bazaar Package Importer
  • Author(s): Marco d'Itri
  • Date: 2002-03-24 22:52:25 UTC
  • Revision ID: james.westby@ubuntu.com-20020324225225-7ru6itlapn03nl35
Tags: upstream-0.9.5a
ImportĀ upstreamĀ versionĀ 0.9.5a

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  sys.h -- 1) very system dependent functions and macros
 
3
 *           2) include for <unistd.h> or <io.h>
 
4
 *           3) defines for u8, u16, u32
 
5
 *
 
6
 *  sys.h is a part of binkd project
 
7
 *
 
8
 *  Copyright (C) 1996  Dima Maloff, 5047/13
 
9
 *
 
10
 *  This program is free software; you can redistribute it and/or modify
 
11
 *  it under the terms of the GNU General Public License as published by
 
12
 *  the Free Software Foundation; either version 2 of the License, or
 
13
 *  (at your option) any later version. See COPYING.
 
14
 */
 
15
 
 
16
/*
 
17
 * $Id: sys.h,v 2.0 2001/01/10 12:12:39 gul Exp $
 
18
 *
 
19
 * $Log: sys.h,v $
 
20
 * Revision 2.0  2001/01/10 12:12:39  gul
 
21
 * Binkd is under CVS again
 
22
 *
 
23
 * Revision 1.3  1997/10/23  03:34:15  mff
 
24
 * many, many changes (forget to ci a version or two)
 
25
 *
 
26
 * Revision 1.1  1996/12/14  07:13:04  mff
 
27
 * Initial revision
 
28
 *
 
29
 */
 
30
#ifndef _sys_h
 
31
#define _sys_h
 
32
 
 
33
#ifdef HAVE_UNISTD_H
 
34
  #include <unistd.h>
 
35
#endif
 
36
#ifdef HAVE_IO_H
 
37
  #include <io.h>
 
38
#endif
 
39
 
 
40
#if defined(WIN32)
 
41
  #include <windows.h>
 
42
  #include <winsock.h>
 
43
#endif
 
44
 
 
45
#ifdef OS2
 
46
  #define INCL_DOS
 
47
  #define INCL_ERRORS
 
48
  #include <os2.h>
 
49
  #include <process.h>
 
50
#endif
 
51
 
 
52
#ifdef HAVE_THREADS
 
53
  #ifndef __IBMC__
 
54
    #include <dos.h>
 
55
  #endif
 
56
  #include <process.h>
 
57
  #if defined(OS2)
 
58
    int gettid ();
 
59
    #define PID() gettid()
 
60
  #elif defined(WIN32)
 
61
    #define PID() ((int)(0xffff & GetCurrentThreadId()))
 
62
  #elif defined(DOS)
 
63
    int getpid ();
 
64
    #define PID() getpid()
 
65
  #else
 
66
    #define PID() ((int)gettid())
 
67
  #endif
 
68
#else
 
69
  #include <sys/wait.h>
 
70
  #define PID() ((int)getpid())
 
71
#endif
 
72
 
 
73
#ifndef F_OK
 
74
  #define F_OK 0
 
75
#endif
 
76
 
 
77
#if defined(UNIX) || defined(AMIGA)
 
78
  /* To be sure rename will fail if the target exists */
 
79
  extern int o_rename (const char *from, const char *to);
 
80
  #define RENAME(f,t) o_rename(f,t)
 
81
#else
 
82
  #define RENAME(f,t) rename(f,t)
 
83
#endif
 
84
 
 
85
#ifdef VISUALCPP
 
86
  #define sleep(a) Sleep(a*1000)
 
87
  #define _beginthread(a,b,c,d) _beginthread(a,c,d)
 
88
#endif
 
89
 
 
90
#ifdef DOS
 
91
  void sleep(unsigned seconds);
 
92
  #define _beginthread(a,b,c,d) a(d)
 
93
  #define _endthread()
 
94
  //_beginthread(void (* __thread)(void *),void * z,unsigned stk,void *arg);
 
95
#endif
 
96
 
 
97
#ifdef __IBMC__
 
98
  #include <errno.h>
 
99
  #define ENOTDIR EBADTYPE
 
100
#endif
 
101
 
 
102
typedef unsigned char u8;
 
103
typedef unsigned short u16;
 
104
typedef unsigned long u32;
 
105
 
 
106
/*
 
107
 * Get free space in a directory
 
108
 */
 
109
unsigned long getfree (char *path);
 
110
 
 
111
/*
 
112
 * Set up break handler, set up exit list if needed
 
113
 */
 
114
int set_break_handlers (void);
 
115
 
 
116
/*
 
117
 * Runs a new thread or forks
 
118
 */
 
119
int branch (void (*) (void *), void *, size_t);
 
120
 
 
121
/*
 
122
 * From breaksig.c -- binkd runs this from exitlist or
 
123
 * from signal handler (Under NT)
 
124
 */
 
125
void exitfunc (void);
 
126
 
 
127
#endif