rev |
line source |
yuuji@0
|
1 /* ========================================================================
|
yuuji@0
|
2 * Copyright 1988-2006 University of Washington
|
yuuji@0
|
3 *
|
yuuji@0
|
4 * Licensed under the Apache License, Version 2.0 (the "License");
|
yuuji@0
|
5 * you may not use this file except in compliance with the License.
|
yuuji@0
|
6 * You may obtain a copy of the License at
|
yuuji@0
|
7 *
|
yuuji@0
|
8 * http://www.apache.org/licenses/LICENSE-2.0
|
yuuji@0
|
9 *
|
yuuji@0
|
10 *
|
yuuji@0
|
11 * ========================================================================
|
yuuji@0
|
12 */
|
yuuji@0
|
13
|
yuuji@0
|
14 /*
|
yuuji@0
|
15 * Program: Operating-system dependent routines -- SVR2 version
|
yuuji@0
|
16 *
|
yuuji@0
|
17 * Author: Mark Crispin
|
yuuji@0
|
18 * Networks and Distributed Computing
|
yuuji@0
|
19 * Computing & Communications
|
yuuji@0
|
20 * University of Washington
|
yuuji@0
|
21 * Administration Building, AG-44
|
yuuji@0
|
22 * Seattle, WA 98195
|
yuuji@0
|
23 * Internet: MRC@CAC.Washington.EDU
|
yuuji@0
|
24 *
|
yuuji@0
|
25 * Date: 10 April 1992
|
yuuji@0
|
26 * Last Edited: 30 August 2006
|
yuuji@0
|
27 */
|
yuuji@0
|
28
|
yuuji@0
|
29 #include "tcp_unix.h" /* must be before osdep includes tcp.h */
|
yuuji@0
|
30 #include "mail.h"
|
yuuji@0
|
31 #include "osdep.h"
|
yuuji@0
|
32 #include <ctype.h>
|
yuuji@0
|
33 #include <stdio.h>
|
yuuji@0
|
34 #include <sys/stat.h>
|
yuuji@0
|
35 #include <netinet/in.h>
|
yuuji@0
|
36 #include <arpa/inet.h>
|
yuuji@0
|
37 #include <netdb.h>
|
yuuji@0
|
38 #include <errno.h>
|
yuuji@0
|
39 extern int errno;
|
yuuji@0
|
40 #include <pwd.h>
|
yuuji@0
|
41 #include <sys/socket.h>
|
yuuji@0
|
42 #include <time.h>
|
yuuji@0
|
43 #define KERNEL
|
yuuji@0
|
44 #include <sys/time.h>
|
yuuji@0
|
45 #undef KERNEL
|
yuuji@0
|
46 #include "misc.h"
|
yuuji@0
|
47
|
yuuji@0
|
48 #define DIR_SIZE(d) sizeof (DIR)
|
yuuji@0
|
49
|
yuuji@0
|
50 extern int sys_nerr;
|
yuuji@0
|
51 extern char *sys_errlist[];
|
yuuji@0
|
52
|
yuuji@0
|
53 #define toint(c) ((c)-'0')
|
yuuji@0
|
54 #define isodigit(c) (((unsigned)(c)>=060)&((unsigned)(c)<=067))
|
yuuji@0
|
55
|
yuuji@0
|
56 #define NBBY 8 /* number of bits in a byte */
|
yuuji@0
|
57 #define FD_SETSIZE 256
|
yuuji@0
|
58
|
yuuji@0
|
59 typedef long fd_mask;
|
yuuji@0
|
60 #define NFDBITS (sizeof(fd_mask) * NBBY)
|
yuuji@0
|
61 /* bits per mask */
|
yuuji@0
|
62 #define howmany(x, y) (((x)+((y)-1))/(y))
|
yuuji@0
|
63
|
yuuji@0
|
64 typedef struct fd_set {
|
yuuji@0
|
65 fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
|
yuuji@0
|
66 } fd_set;
|
yuuji@0
|
67
|
yuuji@0
|
68 #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= \
|
yuuji@0
|
69 (1 << ((n) % NFDBITS)))
|
yuuji@0
|
70 #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= \
|
yuuji@0
|
71 ~(1 << ((n) % NFDBITS)))
|
yuuji@0
|
72 #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & \
|
yuuji@0
|
73 (1 << ((n) % NFDBITS)))
|
yuuji@0
|
74 #define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
|
yuuji@0
|
75
|
yuuji@0
|
76
|
yuuji@0
|
77 #include "fs_unix.c"
|
yuuji@0
|
78 #include "ftl_unix.c"
|
yuuji@0
|
79 #include "nl_unix.c"
|
yuuji@0
|
80 #include "env_unix.c"
|
yuuji@0
|
81 #include "tcp_unix.c"
|
yuuji@0
|
82 #include "gr_wait.c"
|
yuuji@0
|
83 #include "flocksim.c"
|
yuuji@0
|
84 #include "opendir.c"
|
yuuji@0
|
85 #include "scandir.c"
|
yuuji@0
|
86 #include "memmove2.c"
|
yuuji@0
|
87 #include "strstr.c"
|
yuuji@0
|
88 #include "strerror.c"
|
yuuji@0
|
89 #include "strtoul.c"
|
yuuji@0
|
90 #include "tz_sv4.c"
|
yuuji@0
|
91 #include "gethstid.c"
|
yuuji@0
|
92 #include "fsync.c"
|
yuuji@0
|
93 #undef setpgrp
|
yuuji@0
|
94 #include "setpgrp.c"
|
yuuji@0
|
95
|
yuuji@0
|
96 /* Emulator for BSD syslog() routine
|
yuuji@0
|
97 * Accepts: priority
|
yuuji@0
|
98 * message
|
yuuji@0
|
99 * parameters
|
yuuji@0
|
100 */
|
yuuji@0
|
101
|
yuuji@0
|
102 int syslog (int priority,char *message,char *parameters)
|
yuuji@0
|
103 {
|
yuuji@0
|
104 /* nothing here for now */
|
yuuji@0
|
105 }
|
yuuji@0
|
106
|
yuuji@0
|
107
|
yuuji@0
|
108 /* Emulator for BSD openlog() routine
|
yuuji@0
|
109 * Accepts: identity
|
yuuji@0
|
110 * options
|
yuuji@0
|
111 * facility
|
yuuji@0
|
112 */
|
yuuji@0
|
113
|
yuuji@0
|
114 int openlog (char *ident,int logopt,int facility)
|
yuuji@0
|
115 {
|
yuuji@0
|
116 /* nothing here for now */
|
yuuji@0
|
117 }
|
yuuji@0
|
118
|
yuuji@0
|
119
|
yuuji@0
|
120 /* Emulator for BSD ftruncate() routine
|
yuuji@0
|
121 * Accepts: file descriptor
|
yuuji@0
|
122 * length
|
yuuji@0
|
123 */
|
yuuji@0
|
124
|
yuuji@0
|
125 int ftruncate (int fd,unsigned long length)
|
yuuji@0
|
126 {
|
yuuji@0
|
127 return -1; /* gotta figure out how to do this */
|
yuuji@0
|
128 }
|