tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Does "options P1003_1B_SEMAPHORE" still exist?
On Tue, May 06, 2014 at 09:52:53PM +0200, Matthias Drochner wrote:
>
> On Tue, 6 May 2014 21:27:27 +0200
> Joerg Sonnenberger <joerg%britannica.bec.de@localhost> wrote:
> > > While I don't think that it causes these problems, an obvious
> > > deficiency is that our kernel semaphores get inherited to child
> > > processes, while Posix says that they should be closed on exec.
> >
> > Where?
>
> In
> http://pubs.opengroup.org/onlinepubs/009604499/functions/sem_open.html
> right in the first chapter:
>
> The semaphore remains usable by this process until the semaphore is
> closed by a successful call to sem_close(), _exit(), or one of the exec
> functions.
Well, the attached patch would do that...
Joerg
Index: uipc_sem.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sys/kern/uipc_sem.c,v
retrieving revision 1.40
diff -u -p -r1.40 uipc_sem.c
--- uipc_sem.c 29 Mar 2013 01:08:17 -0000 1.40
+++ uipc_sem.c 6 May 2014 21:17:16 -0000
@@ -363,6 +363,7 @@ do_ksem_init(lwp_t *l, u_int val, intptr
if (error) {
return error;
}
+ fd_set_exclose(l, fd, true);
fp->f_type = DTYPE_SEM;
fp->f_flag = FREAD | FWRITE;
fp->f_ops = &semops;
@@ -420,6 +421,7 @@ do_ksem_open(struct lwp *l, const char *
if (error) {
return error;
}
+ fd_set_exclose(l, fd, true);
fp->f_type = DTYPE_SEM;
fp->f_flag = FREAD | FWRITE;
fp->f_ops = &semops;
Home |
Main Index |
Thread Index |
Old Index