summaryrefslogtreecommitdiff
path: root/sys/src/9/port/pgrp.c
diff options
context:
space:
mode:
authorglenda <glenda@9front.local>2022-08-09 17:47:39 +0000
committerglenda <glenda@9front.local>2022-08-09 17:47:39 +0000
commitdb27bd5be753519505973cc0226e3a49ef5aa23e (patch)
tree2c1fc6cc3830f65424282c7a58f57c99f391acef /sys/src/9/port/pgrp.c
parent7e0cdf428a5c2a349293d973b0d07a1affa31e27 (diff)
kernel: use 64 bits for mountids
We dont expose this anymore, wrapping these would be bad. Just send more bits.
Diffstat (limited to 'sys/src/9/port/pgrp.c')
-rw-r--r--sys/src/9/port/pgrp.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/src/9/port/pgrp.c b/sys/src/9/port/pgrp.c
index afb50d9cf..55c357569 100644
--- a/sys/src/9/port/pgrp.c
+++ b/sys/src/9/port/pgrp.c
@@ -9,7 +9,18 @@ enum {
Whinesecs = 10, /* frequency of out-of-resources printing */
};
-static Ref mountid;
+uvlong
+nextmount(void)
+{
+ static uvlong next = 0;
+ static Lock lk;
+ uvlong n;
+
+ lock(&lk);
+ n = ++next;
+ unlock(&lk);
+ return n;
+}
Pgrp*
newpgrp(void)
@@ -119,7 +130,7 @@ pgrpcpy(Pgrp *to, Pgrp *from)
* Allocate mount ids in the same sequence as the parent group
*/
for(m = order; m != nil; m = m->order)
- m->mountid = incref(&mountid);
+ m->mountid = nextmount();
runlock(&from->ns);
wunlock(&to->ns);
}
@@ -239,7 +250,7 @@ newmount(Chan *to, int flag, char *spec)
m = smalloc(sizeof(Mount));
m->to = to;
incref(to);
- m->mountid = incref(&mountid);
+ m->mountid = nextmount();
m->mflag = flag;
if(spec != nil)
kstrdup(&m->spec, spec);