Rao, Nikhil | 1 Apr 2008 08:03
Picon
Favicon

pfind() and the proc structure

Hi List,

The pfind(..) (in kern_proc.c) function below returns the proc structure
for the PID passed in

Say the thread that calls pfind() gets blocked at PROC_LOCK(p) (line 255
below), in the meantime what prevents the process from exiting and
deallocating the proc structure ? Maybe I am missing something simple or
the answer requires knowledge of the mutex implementation.

Thanks,
Nikhil

242 struct proc *
243 pfind(pid)
244         register pid_t pid;
245 {
246         register struct proc *p;
247 
248         sx_slock(&allproc_lock);
249         LIST_FOREACH(p, PIDHASH(pid), p_hash)
250                 if (p->p_pid == pid) {
251                         if (p->p_state == PRS_NEW) {
252                                 p = NULL;
253                                 break;
254                         }
255                         PROC_LOCK(p);
256                         break;
257                 }
258         sx_sunlock(&allproc_lock);
(Continue reading)

Danny Braniss | 1 Apr 2008 08:36
Picon
Picon
Favicon

Re: MODULES_OVERRIDE magic needed

> The following works fine here note its MODULE'S' not MODULE
> 
> makeoptions MODULES_OVERRIDE="linux linprocfs acpi nfsclient nfsserver nullfs accf_http"
> 
>     Regards
>     Steve

> > hi,
> > I'm trying to compile only a few kernel modules, but
> > using MODULES_OVERRIDE I can only select one module.
> > MODULE_OVERRIDE="unionfs"
> > or
> > MODULE_OVERRIDE="if_sis"
> > is ok, but
> > MODULE_OVERRIDE="if_sis unionfs"
> > failes with either
> > if_sis: not found
> > if it's defined in src.conf, or with
> > make: don't know how to make if_sis
> > from the command line.
> > 
> > danny

thanks to all who replied! I was getting frustrated,  what I forgot to mention
was that the 'command' was run from a shell file, and when I tried it directly
it worked, so eval to the rescue, in my shell file now:
	eval "/usr/bin/time $cmd"
where cmd was built starting from
	cmd="MODULES_OVERRIDE=\"sis wlan ndis unionfs\""
thanks again,
(Continue reading)

Roman Divacky | 1 Apr 2008 09:56
Picon
Favicon

Re: pfind() and the proc structure

On Mon, Mar 31, 2008 at 11:03:31PM -0700, Rao, Nikhil wrote:
> Hi List,
> 
> The pfind(..) (in kern_proc.c) function below returns the proc structure
> for the PID passed in
> 
> Say the thread that calls pfind() gets blocked at PROC_LOCK(p) (line 255
> below), in the meantime what prevents the process from exiting and
> deallocating the proc structure ? Maybe I am missing something simple or
> the answer requires knowledge of the mutex implementation.

thats what the allproc_lock is there for
_______________________________________________
freebsd-hackers <at> freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe <at> freebsd.org"

Dag-Erling Smørgrav | 1 Apr 2008 12:14
Picon
Gravatar

Re: Popen and EVFILT_WRITE question

Mel <fbsd.hackers <at> rachie.is-a-geek.net> writes:
> Dag-Erling Smørgrav <des <at> des.no> writes:
> > it will either read input or it won't, and what happens when it
> > reads depends entirely on what the fd it reads from is connected to,
> > whether it's a slow or fast device, blocking or non-blocking, etc.
> The kernel knows that the fd at the end of the pipe is blocked for
> reading. 

I'm not sure what you mean by that; do you mean that it's sleeping in
read() or similar?  What if it uses select(), poll() or kqueue()
instead?

> Does it also know it's the end of a pipe and what's on the other end? Cause 
> it would be a cool filter to have, if you could detect a blocked child as a 
> parent. It sure is better then arbitrary timeouts (this code will run 'make 
> install' as a daemon(3) and write 'yes' on those nasty post-install questions 
> in ports).

Many ports will simply use the default configuration instead of asking
if you build them with -DBATCH.  Those that don't should be fixed,
unless there is a very good reason (such as asking the user to accept a
license before installing).

You could also ask somebody in portmgr <at>  how the package-building cluster
deals with this.

DES
--

-- 
Dag-Erling Smørgrav - des <at> des.no
_______________________________________________
(Continue reading)

Patrick Dung | 1 Apr 2008 14:52
Picon
Favicon

Re: Feature request


--- Mohacsi Janos <mohacsi <at> niif.hu> wrote:

> 
> 
> 
> On Mon, 31 Mar 2008, Patrick Dung wrote:
> 
> > Hello
> >
> > I have some suggestions about improving FreeBSD in some of the
> > areas/features. Let's discuss.
> >
> > 1. Cluster capability
> >
> > As I know, there is:
> > - Linux HA heartbeart in ports
> > - LVS (Linux Virtual Server for load balancing) for FreeBSD 5.3 in
> > http://dragon.linux-vs.org/~dragonfly/htm/lvs_freebsd.htm
> > - SunGrid in ports.
> >
> > But looks like there is no native FreeBSD clustering/load balancing
> > tools to do it in 'a FreeBSD way'.
> 
> There is *BSD way of doing loadbalancing with pf. A big plus is the
> pf 
> supports IPv6, while LVS does not.
>

Yes, I missed the 'sticky-address' feature of pf
(Continue reading)

Ivan Voras | 1 Apr 2008 15:00
Picon
Favicon
Gravatar

Re: Feature request


> Why OpenLDAP? Why not one of the other ldap implementations available
> in the ports? In particular, do any of them already have plugins for
> use with pam?

What are the other LDAP implementations in ports? Especially the ones
that are actively maintained (which excludes tinyldap)? Any compliant
LDAP server with proper schemas will "support" PAM.

Patrick Dung | 1 Apr 2008 15:04
Picon
Favicon

Re: Feature request


--- Mike Meyer <mwm-keyword-freebsdhackers2.e313df <at> mired.org> wrote:

> On Mon, 31 Mar 2008 11:18:56 -0700 (PDT)
> Patrick Dung <patrick_dkt <at> yahoo.com.hk> wrote:
> 
> > 3. Support LDAP SSO out of the box
> > 
> > Linux/Solaris/AIX have native LDAP SSO support.
> > I have asked about this feature before.
> >
> > The problem is whether it should integrate OpenLDAP to base system.
> 
> Why OpenLDAP? Why not one of the other ldap implementations available
> in the ports? In particular, do any of them already have plugins for
> use with pam?
>

OpenLDAP, nss_ldap, pam_ldap should be the stable.
It was around for years and most Linux distro come with it.

For Solaris, it comes with Sun Microsystems implementation of LDAP
library.

 
> > BTW, I see ISC Bind, Sendmail and Amd automounter is in base.
> 
> Yes, but you're asking to move a major chunk of functionality into
> the
> base from ports. That doesn't really happen very often, for lots of
(Continue reading)

Rao, Nikhil | 1 Apr 2008 16:23
Picon
Favicon

RE: pfind() and the proc structure


Ok, I should have caught that :-( Another question - 
Now that the PROC_LOCK on p is obtained the all_proc lock is released
and the function returns, at this point can't the proc get deallocated ?

Nikhil

242 struct proc *
243 pfind(pid)
244         register pid_t pid;
245 {
246         register struct proc *p;
247 
248         sx_slock(&allproc_lock);
249         LIST_FOREACH(p, PIDHASH(pid), p_hash)
250                 if (p->p_pid == pid) {
251                         if (p->p_state == PRS_NEW) {
252                                 p = NULL;
253                                 break;
254                         }
255                         PROC_LOCK(p);
256                         break;
257                 }
258         sx_sunlock(&allproc_lock);
259         return (p);
260 }

-----Original Message-----
From: Roman Divacky [mailto:rdivacky <at> freebsd.org] 
Sent: Tuesday, April 01, 2008 12:56 AM
(Continue reading)

Roman Divacky | 1 Apr 2008 16:32
Picon
Favicon

Re: pfind() and the proc structure

On Tue, Apr 01, 2008 at 07:23:58AM -0700, Rao, Nikhil wrote:
> 
> Ok, I should have caught that :-( Another question - 
> Now that the PROC_LOCK on p is obtained the all_proc lock is released
> and the function returns, at this point can't the proc get deallocated ?

well.. thats why you hold the proc lock, isnt it? :)
_______________________________________________
freebsd-hackers <at> freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe <at> freebsd.org"

Mike Meyer | 1 Apr 2008 17:07
Gravatar

Re: Feature request

On Tue, 01 Apr 2008 15:00:05 +0200 Ivan Voras <ivoras <at> freebsd.org> wrote:

> 
> > Why OpenLDAP? Why not one of the other ldap implementations available
> > in the ports? In particular, do any of them already have plugins for
> > use with pam?
> 
> What are the other LDAP implementations in ports? Especially the ones
> that are actively maintained (which excludes tinyldap)? Any compliant
> LDAP server with proper schemas will "support" PAM.

Why does it need to be actively maintained? After all, if we're going
to pull it into the base system, we'll have to find someone to
actively maintain the code in the base system. If no one is
maintaining the code externally, that in some ways makes their job
easier.

And I didn't say "support", I said "already have plugins". Sure,
anything can be connected to PAM if you can get someone to write the
plugins. Or are you saying there's already an ldap plugin that uses
ldap schemas?

     <mike
--

-- 
Mike Meyer <mwm <at> mired.org>		http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
_______________________________________________
freebsd-hackers <at> freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe <at> freebsd.org"
(Continue reading)


Gmane