From 32f69c36e0eec1227934bbd34854bfebd88686f2 Mon Sep 17 00:00:00 2001 From: rsc Date: Thu, 11 Dec 2003 17:48:38 +0000 Subject: Add support for user-level 9P servers/clients and various bug fixes to go with them. --- src/cmd/sam/unix.c | 88 ------------------------------------------------------ 1 file changed, 88 deletions(-) (limited to 'src/cmd/sam') 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 - -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 -- cgit v1.2.3