diff options
author | rsc <devnull@localhost> | 2003-12-11 17:48:38 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2003-12-11 17:48:38 +0000 |
commit | 32f69c36e0eec1227934bbd34854bfebd88686f2 (patch) | |
tree | 1587e9de84816b77168afa81c1594cc686809910 /src/cmd/sam | |
parent | ac244f8d287a6119155ea672c8fd13c487c5e4c7 (diff) | |
download | plan9port-32f69c36e0eec1227934bbd34854bfebd88686f2.tar.gz plan9port-32f69c36e0eec1227934bbd34854bfebd88686f2.tar.bz2 plan9port-32f69c36e0eec1227934bbd34854bfebd88686f2.zip |
Add support for user-level 9P servers/clients and various bug fixes to go with them.
Diffstat (limited to 'src/cmd/sam')
-rw-r--r-- | src/cmd/sam/unix.c | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/src/cmd/sam/unix.c b/src/cmd/sam/unix.c index 45cfc3bc..b8a67b90 100644 --- a/src/cmd/sam/unix.c +++ b/src/cmd/sam/unix.c @@ -214,92 +214,4 @@ erealloc(void *p, ulong n) return p; } -#if 0 -char * -strdup(const char *s) -{ - return strcpy(emalloc(strlen(s)), s); -} -#endif - -/* -void exits(const char *s) -{ - if (s) fprint(2, "exit: %s\n", s); - exit(s != 0); -} - -void -_exits(const char *s) -{ - if (s) fprint(2, "exit: %s\n", s); - _exit(s != 0); -} - -int errstr(char *buf, int size) -{ - extern int errno; - - snprint(buf, size, "%s", strerror(errno)); - return 1; -} -*/ - -int -create(char *name, int omode, ulong perm) -{ - int mode; - int fd; - - if (omode & OWRITE) mode = O_WRONLY; - else if (omode & OREAD) mode = O_RDONLY; - else mode = O_RDWR; - - if ((fd = open(name, mode|O_CREAT|O_TRUNC, perm)) < 0) - return fd; - - if (omode & OCEXEC) - fcntl(fd, F_SETFD, fcntl(fd,F_GETFD,0) | FD_CLOEXEC); - - /* SES - not exactly right, but hopefully good enough. */ - if (omode & ORCLOSE) - remove(name); - - return fd; -} - -/* SHOULD BE ELSEWHERE */ -#if 0 /* needed on old __APPLE__ */ -#include <lib9.h> - -Lock plk; - -ulong -pread(int fd, void *buf, ulong n, ulong off) -{ - ulong rv; - - lock(&plk); - if (lseek(fd, off, 0) != off) - return -1; - rv = read(fd, buf, n); - unlock(&plk); - - return rv; -} - -ulong -pwrite(int fd, void *buf, ulong n, ulong off) -{ - ulong rv; - - lock(&plk); - if (lseek(fd, off, 0) != off) - return -1; - rv = write(fd, buf, n); - unlock(&plk); - - return rv; -} -#endif |