Subject: Re: core file name format: diffs
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 09/20/1999 11:55:08
> so I've got the core name format stuff ready to commit (I hope :).

Most excellent!

I personally have little use for the core-name stuff, but I'm very
pleased by the supporting mechanisms you've added - they look like
something that can be leveraged usefully in the future.

> The basename of the per-process corename format have to be either
> 'core' or end with '.core', so that it's easy to locate core dumps
> with 'find'.

I'm not at all sure I like this; I think syscall calls made by root
should be exempt from this, and personally would argue an option should
exist to disable the check entirely.  (What I'm thinking here is
something like a database startup script that does something like
"sysctl -w proc.$$.corename = /var/mydb/cores/%p.%t" - appending
".core" is redundant and having to do it is annoying.)

Mind you, I do think such a restriction should be available. :-)  It's
probably better to have it all the time than not have it at all.

> One thing I've found really usefull is that it's now possible to
> change limits of other processes.

That rocks.

> +.It Li n	The process's name
> +.It Li p	The PID of the process
> +.It Li t	The process's creation date
> +.It Li u	The login name, as returned by
> +.Xr getlogin 2

It would be good to state how %p and %t are rendered into text
(primarily for completeness).

> +.It Li PROC_PID_LIMIT
> +Return resources limits, as defined for the

> +The fourth level name is one of:
[...]

> +The fifth level name is one of PROC_PID_LIMIT_TYPE_SOFT or
> +PROC_PID_LIMIT_TYPE_HARD, to select respectively the soft or hard limit.

What type is the value at the end of the chain?  My first reaction is
to assume it's a struct rlimit, but of course this doesn't make sense
on close examination.  In any case, I'd prefer to see an explicit
statement here describing it.

> +		if (*s != '%') {
[...]
> +			continue;
> +		}
> +		if (*(s+1) == 'n') { /* %n */
[...]
> +		}
> +		if (*(s+1) == 'p') { /* %p */
[...]
> +		}
[...]

Why do sequential tests here, rather than just using a switch, any
particular reason?

> +				/* don't allow '.core' as a valid file name */

Why not?

> +	if ((indx = findname(string, "third", bufpp, lp)) == -1)
[...]
> +	if ((indx = findname(string, "fourth", bufpp, lp)) == -1)
[...]
> +	if ((indx = findname(string, "5th", bufpp, lp)) == -1)

Shouldn't that be "fifth", for consistency?

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B