From 6f0783f05f1ec037bea1619306aff367b7f50d47 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 29 May 2002 08:34:38 +0000 Subject: 2002-05-29 Roland McGrath * linux-src/include/linux/net.h (struct socket) [_HURD_]: New member `st_ino'. * io-ops.c (S_io_stat, S_io_identity): Use that. * socket.c (sock_alloc): Initialize it with a monotonic counter. --- pfinet/io-ops.c | 4 ++-- pfinet/linux-src/include/linux/net.h | 1 + pfinet/socket.c | 7 ++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pfinet/io-ops.c b/pfinet/io-ops.c index 4964c80a..b9c7de9d 100644 --- a/pfinet/io-ops.c +++ b/pfinet/io-ops.c @@ -303,7 +303,7 @@ S_io_stat (struct sock_user *user, st->st_fstype = FSTYPE_SOCKET; st->st_fsid = getpid (); - st->st_ino = (ino_t) user->sock; /* why not? */ + st->st_ino = user->sock->st_ino; st->st_mode = S_IFSOCK | ACCESSPERMS; st->st_blksize = 512; /* ???? */ @@ -471,7 +471,7 @@ S_io_identity (struct sock_user *user, *idtype = MACH_MSG_TYPE_MAKE_SEND; *fsys = fsys_identity; *fsystype = MACH_MSG_TYPE_MAKE_SEND; - *fileno = (ino_t) user->sock; /* matches S_io_stat above */ + *fileno = user->sock->st_ino; __mutex_unlock (&global_lock); return 0; diff --git a/pfinet/linux-src/include/linux/net.h b/pfinet/linux-src/include/linux/net.h index 781b9453..b224c49e 100644 --- a/pfinet/linux-src/include/linux/net.h +++ b/pfinet/linux-src/include/linux/net.h @@ -69,6 +69,7 @@ struct socket #ifdef _HURD_ uint_fast32_t refcnt; /* # of sock_user's pointing to this */ mach_port_t identity; /* for io_identity */ + ino_t st_ino; #else struct fasync_struct *fasync_list; /* Asynchronous wake up list */ struct file *file; /* File back pointer for gc */ diff --git a/pfinet/socket.c b/pfinet/socket.c index 82935a57..d56c1794 100644 --- a/pfinet/socket.c +++ b/pfinet/socket.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1995,2000 Free Software Foundation, Inc. + Copyright (C) 1995,2000,02 Free Software Foundation, Inc. This file is part of the GNU Hurd. @@ -41,6 +41,7 @@ sock_register (struct net_proto_family *fam) struct socket * sock_alloc (void) { + static ino_t nextino; /* locked by global_lock */ struct socket *sock; struct condition *c; @@ -55,6 +56,10 @@ sock_alloc (void) sock->refcnt = 1; sock->wait = (void *) c; + if (nextino == 0) + nextino = 2; + sock->st_ino = nextino++; + return sock; } -- cgit v1.2.3