1996-10-29 23:01:55 +00:00
|
|
|
Fix a const-related compiler warning produced by the "execve" wrapper.
|
1997-03-26 21:16:53 +00:00
|
|
|
Move network related wrappers to separate files, for SOCKS support.
|
|
|
|
Fix some things so that it will compile under FreeBSD-3.0.
|
1997-07-11 05:16:45 +00:00
|
|
|
Add missing wrappers for various system calls.
|
1997-04-23 17:07:55 +00:00
|
|
|
Fix numerous argument declarations to agree with their prototypes.
|
|
|
|
Fix the wrapper for ftruncate so that it deals properly with the 64-bit
|
|
|
|
arguments.
|
1996-10-29 23:01:55 +00:00
|
|
|
|
1998-01-17 21:12:15 +00:00
|
|
|
--- m3/m3core/src/runtime/FreeBSD2/RTHeapDepC.c.orig Sat Mar 23 14:52:21 1996
|
1999-03-14 14:00:07 +00:00
|
|
|
+++ m3/m3core/src/runtime/FreeBSD2/RTHeapDepC.c Sun Mar 14 05:43:53 1999
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -80,7 +80,8 @@
|
|
|
|
#include <sys/file.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
#if __FreeBSD__ >= 2
|
|
|
|
-# include <sys/sysctl.h>
|
|
|
|
+#include <sys/sysctl.h>
|
|
|
|
+#include <osreldate.h>
|
|
|
|
#endif
|
|
|
|
#include <sys/mount.h>
|
|
|
|
#include <sys/ipc.h>
|
|
|
|
@@ -89,9 +90,21 @@
|
1997-07-11 05:16:45 +00:00
|
|
|
#include <ufs/ufs/quota.h>
|
|
|
|
#include <sys/signal.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
+#include <sys/stat.h>
|
1997-03-26 21:16:53 +00:00
|
|
|
#include <sys/uio.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
|
|
|
|
|
+#if __FreeBSD__ >= 3
|
|
|
|
+#include <sys/time.h>
|
|
|
|
+#include <nfs/rpcv2.h>
|
|
|
|
+#include <nfs/nfsproto.h>
|
|
|
|
+#include <nfs/nfs.h>
|
|
|
|
+#include <ufs/ufs/ufsmount.h>
|
|
|
|
+#endif
|
1997-04-23 17:07:55 +00:00
|
|
|
+
|
1997-09-25 01:30:33 +00:00
|
|
|
+#include <string.h>
|
1997-04-23 17:07:55 +00:00
|
|
|
+#include <unistd.h>
|
1997-03-26 21:16:53 +00:00
|
|
|
+
|
|
|
|
#ifdef NULL
|
|
|
|
#undef NULL
|
|
|
|
#endif
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -110,22 +123,8 @@
|
1996-10-29 23:01:55 +00:00
|
|
|
/* Unless otherwise noted, all the following wrappers have the same
|
|
|
|
structure. */
|
|
|
|
|
|
|
|
-int accept(s, addr, addrlen) /* ok */
|
|
|
|
-int s;
|
|
|
|
-struct sockaddr *addr;
|
|
|
|
-int *addrlen;
|
|
|
|
-{ int result;
|
|
|
|
-
|
|
|
|
- ENTER_CRITICAL;
|
|
|
|
- MAKE_WRITABLE(addr);
|
|
|
|
- MAKE_WRITABLE(addrlen);
|
|
|
|
- result = syscall(SYS_accept, s, addr, addrlen);
|
|
|
|
- EXIT_CRITICAL;
|
|
|
|
- return result;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
int access(path, mode) /* ok */
|
1997-04-23 17:07:55 +00:00
|
|
|
-char *path;
|
|
|
|
+const char *path;
|
1996-10-29 23:01:55 +00:00
|
|
|
int mode;
|
1997-04-23 17:07:55 +00:00
|
|
|
{ int result;
|
|
|
|
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -137,7 +136,7 @@
|
1997-04-23 17:07:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int acct(file) /* ok */
|
|
|
|
-char *file;
|
|
|
|
+const char *file;
|
|
|
|
{ int result;
|
|
|
|
|
|
|
|
ENTER_CRITICAL;
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -228,19 +227,6 @@
|
1996-10-29 23:01:55 +00:00
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
-int bind(s, name, namelen) /* ok */
|
|
|
|
-int s;
|
|
|
|
-const struct sockaddr *name;
|
|
|
|
-int namelen;
|
|
|
|
-{ int result;
|
|
|
|
-
|
|
|
|
- ENTER_CRITICAL;
|
|
|
|
- MAKE_READABLE(name);
|
|
|
|
- result = syscall(SYS_bind, s, name, namelen);
|
|
|
|
- EXIT_CRITICAL;
|
|
|
|
- return result;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/* not implemented
|
|
|
|
int cachectl(addr, nbytes, op)
|
|
|
|
char *addr;
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -268,7 +254,7 @@
|
1997-04-23 17:07:55 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
int chdir(path) /* ok */
|
|
|
|
-char *path;
|
|
|
|
+const char *path;
|
|
|
|
{ int result;
|
|
|
|
|
|
|
|
ENTER_CRITICAL;
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -278,8 +264,20 @@
|
1997-03-26 21:26:23 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
+int chflags(path, flags)
|
|
|
|
+const char *path;
|
|
|
|
+u_long flags;
|
|
|
|
+{ int result;
|
|
|
|
+
|
|
|
|
+ ENTER_CRITICAL;
|
|
|
|
+ MAKE_READABLE(path);
|
|
|
|
+ result = syscall(SYS_chflags, path, flags);
|
|
|
|
+ EXIT_CRITICAL;
|
|
|
|
+ return result;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
int chmod(path, mode) /* ok */
|
1997-07-11 05:16:45 +00:00
|
|
|
-char *path;
|
|
|
|
+const char *path;
|
1997-03-26 21:26:23 +00:00
|
|
|
mode_t mode;
|
1997-07-11 05:16:45 +00:00
|
|
|
{ int result;
|
|
|
|
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -291,7 +289,7 @@
|
1997-04-23 17:07:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int chown(path, owner, group) /* ok */
|
|
|
|
-char *path;
|
|
|
|
+const char *path;
|
|
|
|
uid_t owner;
|
|
|
|
gid_t group;
|
|
|
|
{ int result;
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -304,7 +302,7 @@
|
1997-04-23 17:07:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int chroot(dirname) /* ok */
|
|
|
|
-char *dirname;
|
|
|
|
+const char *dirname;
|
|
|
|
{ int result;
|
|
|
|
|
|
|
|
ENTER_CRITICAL;
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -314,19 +312,6 @@
|
1996-10-29 23:01:55 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
-int connect(s, name, namelen) /* ok */
|
|
|
|
-int s;
|
|
|
|
-const struct sockaddr *name;
|
|
|
|
-int namelen;
|
|
|
|
-{ int result;
|
|
|
|
-
|
|
|
|
- ENTER_CRITICAL;
|
|
|
|
- MAKE_READABLE(name);
|
|
|
|
- result = syscall(SYS_connect, s, name, namelen);
|
|
|
|
- EXIT_CRITICAL;
|
|
|
|
- return result;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/* not implemented (obsolete)
|
|
|
|
int creat(name, mode)
|
|
|
|
const char *name;
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -356,8 +341,8 @@
|
1996-10-29 23:01:55 +00:00
|
|
|
result = syscall(SYS_execve, name, argv, envp);
|
|
|
|
if (result == -1 && errno == EFAULT) {
|
|
|
|
MAKE_READABLE(name);
|
|
|
|
- { char **a; for (a = argv; *a; a++) MAKE_READABLE(*a); }
|
|
|
|
- { char **e; for (e = envp; *e; e++) MAKE_READABLE(*e); }
|
|
|
|
+ { char * const *a; for (a = argv; *a; a++) MAKE_READABLE(*a); }
|
|
|
|
+ { char * const *e; for (e = envp; *e; e++) MAKE_READABLE(*e); }
|
|
|
|
} else {
|
|
|
|
return result;
|
|
|
|
}
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -473,7 +458,7 @@
|
1997-04-23 17:07:55 +00:00
|
|
|
|
|
|
|
int getgroups(gidsetsize, grouplist) /* ok */
|
|
|
|
int gidsetsize;
|
|
|
|
-int grouplist[];
|
|
|
|
+gid_t grouplist[];
|
|
|
|
{ int result;
|
|
|
|
|
|
|
|
ENTER_CRITICAL;
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -513,20 +498,6 @@
|
1996-10-29 23:01:55 +00:00
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
-int getpeername(s, name, namelen) /* ok */
|
|
|
|
-int s;
|
|
|
|
-struct sockaddr *name;
|
|
|
|
-int *namelen;
|
|
|
|
-{ int result;
|
|
|
|
-
|
|
|
|
- ENTER_CRITICAL;
|
|
|
|
- MAKE_WRITABLE(name);
|
|
|
|
- MAKE_WRITABLE(namelen);
|
|
|
|
- result = syscall(SYS_getpeername, s, name, namelen);
|
|
|
|
- EXIT_CRITICAL;
|
|
|
|
- return result;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
int getrlimit(resource, rlp) /* ok */
|
|
|
|
int resource;
|
|
|
|
struct rlimit *rlp;
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -551,20 +522,6 @@
|
1996-10-29 23:01:55 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
-int getsockname(s, name, namelen) /* ok */
|
|
|
|
-int s;
|
|
|
|
-struct sockaddr *name;
|
|
|
|
-int *namelen;
|
|
|
|
-{ int result;
|
|
|
|
-
|
|
|
|
- ENTER_CRITICAL;
|
|
|
|
- MAKE_WRITABLE(name);
|
|
|
|
- MAKE_WRITABLE(namelen);
|
|
|
|
- result = syscall(SYS_getsockname, s, name, namelen);
|
|
|
|
- EXIT_CRITICAL;
|
|
|
|
- return result;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
int getsockopt(s, level, optname, optval, optlen) /* ok */
|
|
|
|
int s, level, optname;
|
|
|
|
void *optval;
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -629,9 +586,24 @@
|
1997-07-11 05:16:45 +00:00
|
|
|
return result;
|
1997-04-23 17:07:55 +00:00
|
|
|
}
|
|
|
|
|
1997-07-11 05:16:45 +00:00
|
|
|
+#ifdef SYS_lchown
|
|
|
|
+int lchown(path, owner, group) /* ok */
|
|
|
|
+const char *path;
|
|
|
|
+uid_t owner;
|
|
|
|
+gid_t group;
|
|
|
|
+{ int result;
|
|
|
|
+
|
|
|
|
+ ENTER_CRITICAL;
|
|
|
|
+ MAKE_READABLE(path);
|
|
|
|
+ result = syscall(SYS_lchown, path, owner, group);
|
|
|
|
+ EXIT_CRITICAL;
|
|
|
|
+ return result;
|
|
|
|
+}
|
|
|
|
+#endif /* SYS_lchown */
|
|
|
|
+
|
1997-04-23 17:07:55 +00:00
|
|
|
int link(name1, name2) /* ok */
|
|
|
|
-char *name1;
|
|
|
|
-char *name2;
|
|
|
|
+const char *name1;
|
|
|
|
+const char *name2;
|
|
|
|
{ int result;
|
|
|
|
|
|
|
|
ENTER_CRITICAL;
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -643,7 +615,7 @@
|
1997-07-11 05:16:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int lstat(path, buf) /* ok */
|
|
|
|
-char *path;
|
|
|
|
+const char *path;
|
|
|
|
struct stat *buf;
|
|
|
|
{ int result;
|
|
|
|
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -656,7 +628,7 @@
|
1997-04-23 17:07:55 +00:00
|
|
|
}
|
|
|
|
|
1997-07-11 05:16:45 +00:00
|
|
|
int mkdir(path, mode) /* ok */
|
|
|
|
-char *path;
|
|
|
|
+const char *path;
|
|
|
|
mode_t mode;
|
|
|
|
{ int result;
|
|
|
|
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -667,8 +639,20 @@
|
1997-07-11 05:16:45 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
+int mkfifo(path, mode) /* ok */
|
|
|
|
+const char *path;
|
|
|
|
+mode_t mode;
|
|
|
|
+{ int result;
|
|
|
|
+
|
|
|
|
+ ENTER_CRITICAL;
|
|
|
|
+ MAKE_READABLE(path);
|
|
|
|
+ result = syscall(SYS_mkfifo, path, mode);
|
|
|
|
+ EXIT_CRITICAL;
|
|
|
|
+ return result;
|
|
|
|
+}
|
|
|
|
+
|
1997-04-23 17:07:55 +00:00
|
|
|
int mknod(path, mode, dev) /* ok */
|
|
|
|
-char *path;
|
|
|
|
+const char *path;
|
|
|
|
mode_t mode;
|
|
|
|
dev_t dev;
|
|
|
|
{ int result;
|
1997-09-25 01:30:33 +00:00
|
|
|
@@ -680,13 +664,51 @@
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
-/* quite different ...
|
|
|
|
-int mount(special, name, rwflag, type, options)
|
|
|
|
-char *special;
|
|
|
|
-char *name;
|
|
|
|
-int rwflag, type;
|
|
|
|
-char *options;
|
|
|
|
-*/
|
|
|
|
+#if __FreeBSD_version >= 300001 /* New form of mount(2) */
|
|
|
|
+int
|
|
|
|
+mount(type, dir, flags, data)
|
|
|
|
+ const char *type;
|
|
|
|
+ const char *dir;
|
|
|
|
+ int flags;
|
|
|
|
+ void *data;
|
|
|
|
+{ int result;
|
|
|
|
+ struct ufs_args *u_data;
|
|
|
|
+ struct mfs_args *m_data;
|
|
|
|
+ struct nfs_args *n_data;
|
|
|
|
+
|
|
|
|
+ ENTER_CRITICAL;
|
|
|
|
+ MAKE_READABLE(type);
|
|
|
|
+ MAKE_READABLE(dir);
|
|
|
|
+ if (strcmp(type, "ufs") == 0) {
|
|
|
|
+ u_data = (struct ufs_args*) data;
|
|
|
|
+ MAKE_READABLE(u_data);
|
|
|
|
+ MAKE_READABLE(u_data->fspec);
|
|
|
|
+ result = syscall(SYS_mount, type, dir, flags, data);
|
|
|
|
+ } else if (strcmp(type, "mfs") == 0) {
|
|
|
|
+ m_data = (struct mfs_args*) data;
|
|
|
|
+ MAKE_READABLE(m_data);
|
|
|
|
+ MAKE_READABLE(m_data->fspec);
|
|
|
|
+ result = syscall(SYS_mount, type, dir, flags, data);
|
|
|
|
+ } else if (strcmp(type, "nfs") == 0) {
|
|
|
|
+ n_data = (struct nfs_args*) data;
|
|
|
|
+ MAKE_READABLE(n_data);
|
|
|
|
+ MAKE_READABLE(n_data->addr);
|
|
|
|
+ MAKE_READABLE(n_data->fh);
|
|
|
|
+ MAKE_READABLE(n_data->hostname);
|
|
|
|
+ result = syscall(SYS_mount, type, dir, flags, data);
|
|
|
|
+ } else { /* Not anything we recognize. */
|
|
|
|
+ MAKE_READABLE(data);
|
|
|
|
+ result = syscall(SYS_mount, type, dir, flags, data);
|
|
|
|
+ }
|
|
|
|
+ EXIT_CRITICAL;
|
|
|
|
+ if (result != -1) {
|
|
|
|
+ result = 0;
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#else /* __FreeBSD_version >= 300001 */
|
|
|
|
+
|
|
|
|
int mount(type, dir, flags, data)
|
|
|
|
int type;
|
|
|
|
const char *dir;
|
|
|
|
@@ -723,6 +745,7 @@
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
+#endif /* __FreeBSD_version >= 300001 */
|
|
|
|
|
|
|
|
int msgctl(msqid, cmd, buf) /* ok */
|
|
|
|
int msqid, cmd;
|
1999-03-14 14:00:07 +00:00
|
|
|
@@ -793,9 +816,13 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
int quotactl(path, cmd, uid, addr) /* ok */
|
|
|
|
-const char *path;
|
|
|
|
-int cmd, uid;
|
|
|
|
-char *addr;
|
|
|
|
+ const char *path;
|
|
|
|
+ int cmd, uid;
|
|
|
|
+#if __FreeBSD_version >= 400002
|
|
|
|
+ void *addr;
|
|
|
|
+#else
|
|
|
|
+ char *addr;
|
|
|
|
+#endif
|
|
|
|
{ int result;
|
|
|
|
|
|
|
|
ENTER_CRITICAL;
|
|
|
|
@@ -821,21 +848,8 @@
|
1996-10-29 23:01:55 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
-int read(d, buf, nbytes) /* ok */
|
|
|
|
-int d;
|
|
|
|
-char *buf;
|
|
|
|
-size_t nbytes;
|
|
|
|
-{ int result;
|
|
|
|
-
|
|
|
|
- ENTER_CRITICAL;
|
|
|
|
- MAKE_WRITABLE(buf);
|
|
|
|
- result = syscall(SYS_read, d, buf, nbytes);
|
|
|
|
- EXIT_CRITICAL;
|
|
|
|
- return result;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
int readlink(path, buf, bufsiz) /* ok */
|
1997-04-23 17:07:55 +00:00
|
|
|
-char *path;
|
|
|
|
+const char *path;
|
1996-10-29 23:01:55 +00:00
|
|
|
char *buf;
|
1997-04-23 17:07:55 +00:00
|
|
|
int bufsiz;
|
|
|
|
{ int result;
|
1999-03-14 14:00:07 +00:00
|
|
|
@@ -865,46 +879,6 @@
|
1996-10-29 23:01:55 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
-int recv(s, buf, len, flags) /* ok */
|
|
|
|
-int s;
|
|
|
|
-void *buf;
|
|
|
|
-#if __FreeBSD__ >=2
|
|
|
|
-size_t len;
|
|
|
|
-#else
|
|
|
|
-int len;
|
|
|
|
-#endif
|
|
|
|
-int flags;
|
|
|
|
-{ int result;
|
|
|
|
-
|
|
|
|
- ENTER_CRITICAL;
|
|
|
|
- MAKE_WRITABLE(buf);
|
|
|
|
- result = syscall(SYS_recvfrom, s, buf, len, flags, NULL, 0);
|
|
|
|
- EXIT_CRITICAL;
|
|
|
|
- return result;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-int recvfrom(s, buf, len, flags, from, fromlen) /* ok */
|
|
|
|
-int s;
|
|
|
|
-void *buf;
|
|
|
|
-#if __FreeBSD__ >=2
|
|
|
|
-size_t len;
|
|
|
|
-#else
|
|
|
|
-int len;
|
|
|
|
-#endif
|
|
|
|
-int flags;
|
|
|
|
-struct sockaddr *from;
|
|
|
|
-int *fromlen;
|
|
|
|
-{ int result;
|
|
|
|
-
|
|
|
|
- ENTER_CRITICAL;
|
|
|
|
- MAKE_WRITABLE(buf);
|
|
|
|
- MAKE_WRITABLE(from);
|
|
|
|
- MAKE_WRITABLE(fromlen);
|
|
|
|
- result = syscall(SYS_recvfrom, s, buf, len, flags, from, fromlen);
|
|
|
|
- EXIT_CRITICAL;
|
|
|
|
- return result;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
int recvmsg(s, msg, flags) /* ok */
|
|
|
|
int s;
|
|
|
|
struct msghdr msg[];
|
1999-03-14 14:00:07 +00:00
|
|
|
@@ -940,7 +914,7 @@
|
1997-04-23 17:07:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int rmdir(path) /* ok */
|
|
|
|
-char *path;
|
|
|
|
+const char *path;
|
|
|
|
{ int result;
|
|
|
|
|
|
|
|
ENTER_CRITICAL;
|
1999-03-14 14:00:07 +00:00
|
|
|
@@ -950,44 +924,42 @@
|
1996-10-29 23:01:55 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
-int select(nfds, readfds, writefds, exceptfds, timeout) /* ok */
|
|
|
|
-int nfds;
|
|
|
|
-fd_set *readfds;
|
|
|
|
-fd_set *writefds;
|
|
|
|
-fd_set *exceptfds;
|
|
|
|
-struct timeval *timeout;
|
|
|
|
-{ int result;
|
|
|
|
-
|
|
|
|
- ENTER_CRITICAL;
|
|
|
|
- MAKE_WRITABLE(readfds);
|
|
|
|
- MAKE_WRITABLE(writefds);
|
|
|
|
- MAKE_WRITABLE(exceptfds);
|
|
|
|
- MAKE_READABLE(timeout);
|
|
|
|
- result = syscall(SYS_select, nfds, readfds, writefds, exceptfds, timeout);
|
|
|
|
- EXIT_CRITICAL;
|
|
|
|
- return result;
|
|
|
|
-}
|
1998-06-02 23:21:26 +00:00
|
|
|
+int
|
1998-09-19 17:49:22 +00:00
|
|
|
+#if (227002 <= __FreeBSD_version && __FreeBSD_version < 300000) || \
|
|
|
|
+ __FreeBSD_version >= 300002
|
1998-06-02 23:21:26 +00:00
|
|
|
+semctl(int semid, int semnum, int cmd, ...)
|
|
|
|
+#else
|
|
|
|
+semctl(int semid, int semnum, int cmd, union semun arg)
|
|
|
|
+#endif
|
|
|
|
+{
|
|
|
|
+ int result;
|
1998-10-06 03:01:41 +00:00
|
|
|
+#if (227002 <= __FreeBSD_version && __FreeBSD_version < 300000) || \
|
|
|
|
+ __FreeBSD_version >= 300002
|
1998-06-02 23:21:26 +00:00
|
|
|
+ union semun arg;
|
|
|
|
+ va_list ap;
|
|
|
|
|
|
|
|
-int semctl(semid, semnum, cmd, arg) /* ok ? */
|
|
|
|
-int semid, cmd;
|
|
|
|
-int semnum;
|
|
|
|
-union semun arg;
|
|
|
|
-{ int result;
|
|
|
|
+ va_start(ap, cmd);
|
|
|
|
+ arg = va_arg(ap, union semun);
|
|
|
|
+ va_end(ap);
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
ENTER_CRITICAL;
|
|
|
|
switch (cmd) {
|
|
|
|
- case GETNCNT:
|
|
|
|
- case GETPID:
|
|
|
|
- case GETVAL:
|
|
|
|
- case GETALL:
|
|
|
|
- case GETZCNT:
|
|
|
|
+
|
|
|
|
+ case IPC_SET:
|
|
|
|
MAKE_READABLE(arg.buf);
|
|
|
|
break;
|
|
|
|
+
|
|
|
|
case SETALL:
|
|
|
|
- case SETVAL:
|
|
|
|
+ MAKE_READABLE(arg.array);
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case IPC_STAT:
|
|
|
|
MAKE_WRITABLE(arg.buf);
|
|
|
|
break;
|
|
|
|
- default:
|
|
|
|
+
|
|
|
|
+ case GETALL:
|
|
|
|
+ MAKE_WRITABLE(arg.array);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
result = syscall(SYS_semsys, 0, semid, semnum, cmd, arg);
|
1999-03-14 14:00:07 +00:00
|
|
|
@@ -1012,24 +984,6 @@
|
1996-10-29 23:01:55 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
-int send(s, msg, len, flags) /* ok */
|
|
|
|
-int s;
|
|
|
|
-const void *msg;
|
|
|
|
-#if __FreeBSD__ >=2
|
|
|
|
-size_t len;
|
|
|
|
-#else
|
|
|
|
-int len;
|
|
|
|
-#endif
|
|
|
|
-int flags;
|
|
|
|
-{ int result;
|
|
|
|
-
|
|
|
|
- ENTER_CRITICAL;
|
|
|
|
- MAKE_READABLE(msg);
|
|
|
|
- result = syscall(SYS_sendto, s, msg, len, flags, NULL, 0);
|
|
|
|
- EXIT_CRITICAL;
|
|
|
|
- return result;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
int sendmsg(s, msg, flags) /* ok */
|
|
|
|
int s;
|
|
|
|
const struct msghdr msg[];
|
1999-03-14 14:00:07 +00:00
|
|
|
@@ -1051,29 +1005,8 @@
|
1996-10-29 23:01:55 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
-int sendto(s, msg, len, flags, to, tolen) /* ok */
|
|
|
|
-int s;
|
|
|
|
-const void *msg;
|
|
|
|
-#if __FreeBSD__ >=2
|
|
|
|
-size_t len;
|
|
|
|
-#else
|
|
|
|
-int len;
|
|
|
|
-#endif
|
|
|
|
-int flags;
|
|
|
|
-const struct sockaddr *to;
|
|
|
|
-int tolen;
|
|
|
|
-{ int result;
|
|
|
|
-
|
|
|
|
- ENTER_CRITICAL;
|
|
|
|
- MAKE_READABLE(msg);
|
|
|
|
- MAKE_READABLE(to);
|
|
|
|
- result = syscall(SYS_sendto, s, msg, len, flags, to, tolen);
|
|
|
|
- EXIT_CRITICAL;
|
|
|
|
- return result;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
int setdomainname(name, namelen) /* ok */
|
1997-04-23 17:07:55 +00:00
|
|
|
-char *name;
|
|
|
|
+const char *name;
|
1996-10-29 23:01:55 +00:00
|
|
|
int namelen;
|
1997-04-23 17:07:55 +00:00
|
|
|
{ int result;
|
|
|
|
|
1999-03-14 14:00:07 +00:00
|
|
|
@@ -1086,7 +1019,7 @@
|
1997-04-23 17:07:55 +00:00
|
|
|
|
|
|
|
int setgroups(ngroups, gidset) /* ok */
|
|
|
|
int ngroups;
|
|
|
|
-int *gidset;
|
|
|
|
+const gid_t *gidset;
|
|
|
|
{ int result;
|
|
|
|
|
|
|
|
ENTER_CRITICAL;
|
1999-03-14 14:00:07 +00:00
|
|
|
@@ -1097,7 +1030,7 @@
|
1997-04-23 17:07:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int sethostname(name, namelen) /* ok */
|
|
|
|
-char *name;
|
|
|
|
+const char *name;
|
|
|
|
int namelen;
|
|
|
|
{ int result;
|
|
|
|
#if __FreeBSD__ >= 2
|
1999-03-14 14:00:07 +00:00
|
|
|
@@ -1213,20 +1146,20 @@
|
1997-07-11 05:16:45 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
-/* not implemented
|
|
|
|
-int sigpending(set)
|
|
|
|
-sigset_t *set;
|
|
|
|
+int sigaction(sig, act, oact)
|
|
|
|
+int sig;
|
|
|
|
+const struct sigaction *act;
|
|
|
|
+struct sigaction *oact;
|
|
|
|
{ int result;
|
|
|
|
|
|
|
|
ENTER_CRITICAL;
|
|
|
|
- MAKE_WRITABLE(set);
|
|
|
|
- result = syscall(SYS_sigpending, set);
|
|
|
|
+ MAKE_READABLE(act);
|
|
|
|
+ MAKE_WRITABLE(oact);
|
|
|
|
+ result = syscall(SYS_sigaction, sig, act, oact);
|
|
|
|
EXIT_CRITICAL;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
-*/
|
|
|
|
|
|
|
|
-#if __FreeBSD__ >= 2
|
|
|
|
int sigaltstack(ss, oss) /* ok */
|
|
|
|
const struct sigaltstack *ss;
|
|
|
|
struct sigaltstack *oss;
|
1999-03-14 14:00:07 +00:00
|
|
|
@@ -1239,20 +1172,6 @@
|
1997-07-11 05:16:45 +00:00
|
|
|
EXIT_CRITICAL;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
-#else
|
|
|
|
-int sigstack(ss, oss) /* ok */
|
|
|
|
-const struct sigstack *ss;
|
|
|
|
-struct sigstack *oss;
|
1997-07-11 05:51:28 +00:00
|
|
|
-{ int result;
|
|
|
|
-
|
|
|
|
- ENTER_CRITICAL;
|
1997-07-11 05:16:45 +00:00
|
|
|
- MAKE_READABLE(ss);
|
|
|
|
- MAKE_WRITABLE(oss);
|
|
|
|
- result = syscall(SYS_sigstack, ss, oss);
|
1997-07-11 05:51:28 +00:00
|
|
|
- EXIT_CRITICAL;
|
|
|
|
- return result;
|
|
|
|
-}
|
1997-07-11 05:16:45 +00:00
|
|
|
-#endif
|
|
|
|
|
|
|
|
int socketpair(d, type, protocol, sv) /* ok */
|
|
|
|
int d, type, protocol;
|
1999-03-14 14:00:07 +00:00
|
|
|
@@ -1267,7 +1186,7 @@
|
1997-07-11 05:16:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int stat(path, buf) /* ok */
|
|
|
|
-char *path;
|
|
|
|
+const char *path;
|
|
|
|
struct stat *buf;
|
|
|
|
{ int result;
|
|
|
|
|
1999-03-14 14:00:07 +00:00
|
|
|
@@ -1280,7 +1199,7 @@
|
1997-04-23 17:07:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int swapon(special) /* ok */
|
|
|
|
-char *special;
|
|
|
|
+const char *special;
|
|
|
|
{ int result;
|
|
|
|
|
|
|
|
ENTER_CRITICAL;
|
1999-03-14 14:00:07 +00:00
|
|
|
@@ -1291,8 +1210,8 @@
|
1997-04-23 17:07:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int symlink(name1, name2) /* ok */
|
|
|
|
-char *name1;
|
|
|
|
-char *name2;
|
|
|
|
+const char *name1;
|
|
|
|
+const char *name2;
|
|
|
|
{ int result;
|
|
|
|
|
|
|
|
ENTER_CRITICAL;
|
1999-03-14 14:00:07 +00:00
|
|
|
@@ -1304,14 +1223,14 @@
|
1997-04-23 17:07:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int truncate(path, length) /* ok */
|
|
|
|
-char *path;
|
|
|
|
-long length;
|
|
|
|
+const char *path;
|
|
|
|
+off_t length;
|
|
|
|
{ int result;
|
|
|
|
- off_t len = (off_t)length;
|
|
|
|
|
|
|
|
ENTER_CRITICAL;
|
|
|
|
MAKE_READABLE(path);
|
|
|
|
- result = syscall(SYS_truncate, path, len);
|
|
|
|
+ /* The casts below pad "path" out to a 64-bit value as required. */
|
|
|
|
+ result = __syscall(SYS_truncate, (u_quad_t) (u_int) path, length);
|
|
|
|
EXIT_CRITICAL;
|
|
|
|
return result;
|
|
|
|
}
|
1999-03-14 14:00:07 +00:00
|
|
|
@@ -1328,7 +1247,7 @@
|
1997-04-23 17:07:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int unlink(path) /* ok */
|
|
|
|
-char *path;
|
|
|
|
+const char *path;
|
|
|
|
{ int result;
|
|
|
|
|
|
|
|
ENTER_CRITICAL;
|
1999-03-14 14:00:07 +00:00
|
|
|
@@ -1414,19 +1333,6 @@
|
1996-10-29 23:01:55 +00:00
|
|
|
ENTER_CRITICAL;
|
|
|
|
MAKE_WRITABLE(status);
|
|
|
|
result = syscall(SYS_wait4, pid, status, options, NULL);
|
|
|
|
- EXIT_CRITICAL;
|
|
|
|
- return result;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-int write(fd, buf, nbytes) /* ok */
|
|
|
|
-int fd;
|
|
|
|
-char *buf;
|
|
|
|
-int nbytes;
|
|
|
|
-{ int result;
|
|
|
|
-
|
|
|
|
- ENTER_CRITICAL;
|
|
|
|
- MAKE_READABLE(buf);
|
|
|
|
- result = syscall(SYS_write, fd, buf, nbytes);
|
|
|
|
EXIT_CRITICAL;
|
|
|
|
return result;
|
|
|
|
}
|