home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
- *
- * $Source$
- * $Date$
- * $Revision$
- * $State$
- * $Author$
- *
- * $Log$
- * (c) Copyright 1995 Sergio Monesi
- ***************************************************************************/
-
- static const char rcs_id[] = "$Id$";
-
- #include <errno.h>
-
- #include <sys/unix.h>
- #include <sys/socket.h>
- #include <sys/dev.h>
- #include <fcntl.h>
-
- int
- accept (int s, struct sockaddr *name, int *namelen)
- {
- register struct file *f;
- int nfd;
- int nsd;
-
- /* printf("U! accept: fd=%d, realsocket=%d\n",s,(__u->file+s)->r[0]); */
-
- if ((nsd = _accept ((__u->file + s)->r[0], name, namelen)) < 0)
- return (-1);
-
- if ((nfd = __fdalloc ()) < 0)
- return (-1);
-
- /* printf("U! accept: nsd=%d nfd=%d\n",nsd,nfd); */
-
- f = __u->file + nfd;
- f->oflag = O_RDWR | O_BINARY;
- f->r[0] = nsd;
- f->r[1] = -1;
-
- f->dev = makedev (DEV_SOCKET, nsd);
-
- f->dup = f;
- f->pid = __u->pid;
-
- return (nfd);
- }
-