annotate src/osdep/unix/os_sv2.c @ 0:ada5e610ab86

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

yatex.org