0
|
1 /* ========================================================================
|
|
2 * Copyright 1988-2006 University of Washington
|
|
3 *
|
|
4 * Licensed under the Apache License, Version 2.0 (the "License");
|
|
5 * you may not use this file except in compliance with the License.
|
|
6 * You may obtain a copy of the License at
|
|
7 *
|
|
8 * http://www.apache.org/licenses/LICENSE-2.0
|
|
9 *
|
|
10 *
|
|
11 * ========================================================================
|
|
12 */
|
|
13
|
|
14 /*
|
|
15 * Program: Operating-system dependent routines -- SVR2 version
|
|
16 *
|
|
17 * Author: Mark Crispin
|
|
18 * Networks and Distributed Computing
|
|
19 * Computing & Communications
|
|
20 * University of Washington
|
|
21 * Administration Building, AG-44
|
|
22 * Seattle, WA 98195
|
|
23 * Internet: MRC@CAC.Washington.EDU
|
|
24 *
|
|
25 * Date: 10 April 1992
|
|
26 * Last Edited: 20 December 2006
|
|
27 */
|
|
28
|
|
29 #include <unistd.h>
|
|
30 #include <string.h>
|
|
31 #define char void
|
|
32 #include <memory.h>
|
|
33 #undef char
|
|
34 #include <sys/types.h>
|
|
35 #include <sys/dir.h>
|
|
36 #include <fcntl.h>
|
|
37 #include <syslog.h>
|
|
38 #include <sys/file.h>
|
|
39 #include <ustat.h>
|
|
40
|
|
41
|
|
42 /* Many versions of SysV get this wrong */
|
|
43
|
|
44 #define setpgrp(a,b) Setpgrp(a,b)
|
|
45 int Setpgrp (int pid,int gid);
|
|
46
|
|
47
|
|
48 /* Different names between BSD and SVR4 */
|
|
49
|
|
50 #define L_SET SEEK_SET
|
|
51 #define L_INCR SEEK_CUR
|
|
52 #define L_XTND SEEK_END
|
|
53
|
|
54 #define lstat stat
|
|
55 #define random lrand48
|
|
56
|
|
57 #define SIGSTOP SIGQUIT
|
|
58
|
|
59 #define S_IFLNK 0120000
|
|
60
|
|
61
|
|
62 /* syslog() emulation */
|
|
63
|
|
64 #define LOG_MAIL (2<<3) /* mail system */
|
|
65 #define LOG_DAEMON (3<<3) /* system daemons */
|
|
66 #define LOG_AUTH (4<<3) /* security/authorization messages */
|
|
67 #define LOG_ALERT 1 /* action must be taken immediately */
|
|
68 #define LOG_CONS 0x02 /* log on the console if errors in sending */
|
|
69 #define LOG_ODELAY 0x04 /* delay open until syslog() is called */
|
|
70 #define LOG_NDELAY 0x08 /* don't delay open */
|
|
71 #define LOG_NOWAIT 0x10 /* if forking to log on console, don't wait() */
|
|
72
|
|
73
|
|
74 /* For setitimer() emulation */
|
|
75
|
|
76 #define ITIMER_REAL 0
|
|
77
|
|
78
|
|
79 /* For opendir() emulation */
|
|
80
|
|
81 typedef struct _dirdesc {
|
|
82 int dd_fd;
|
|
83 long dd_loc;
|
|
84 long dd_size;
|
|
85 char *dd_buf;
|
|
86 } DIR;
|
|
87
|
|
88 struct passwd *getpwent (void);
|
|
89 struct passwd *getpwuid (int uid);
|
|
90 struct passwd *getpwnam (char *name);
|
|
91 struct group *getgrnam (char *name);
|
|
92
|
|
93 char *getenv (char *name);
|
|
94 long gethostid (void);
|
|
95 void *memmove (void *s,void *ct,size_t n);
|
|
96 char *strstr (char *cs,char *ct);
|
|
97 char *strerror (int n);
|
|
98 unsigned long strtoul (char *s,char **endp,int base);
|
|
99 DIR *opendir (char * name);
|
|
100 int closedir (DIR *d);
|
|
101 struct direct *readdir (DIR *d);
|
|
102 typedef int (*select_t) (struct direct *name);
|
|
103 typedef int (*compar_t) (void *d1,void *d2);
|
|
104 int scandir (char *dirname,struct direct ***namelist,select_t select,
|
|
105 compar_t compar);
|
|
106 int alphasort (void *d1,void *d2);
|
|
107 int fsync (int fd);
|
|
108 int openlog (ident,logopt,facility);
|
|
109 int syslog (priority,message,parameters ...);
|
|
110 void *malloc (size_t byteSize);
|
|
111 void free (void *ptr);
|
|
112 void *realloc (void *oldptr,size_t newsize);
|
|
113
|
|
114
|
|
115 #include "env_unix.h"
|
|
116 #include "fs.h"
|
|
117 #include "ftl.h"
|
|
118 #include "nl.h"
|
|
119 #include "tcp.h"
|
|
120 #include "flocksim.h"
|