Subject: Re: core file name format: diffs
To: None <>
From: Manuel Bouyer <>
List: tech-kern
Date: 09/20/1999 18:12:28
Content-Type: text/plain; charset=us-ascii

Here are some more diffs (all documentation updates).

Manuel Bouyer, LIP6, Universite Paris VI. 

Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="sysctl.diff2"

Index: bin/csh/csh.1
RCS file: /cvsroot/basesrc/bin/csh/csh.1,v
retrieving revision 1.25
diff -u -r1.25 csh.1
--- csh.1	1999/07/30 01:08:12	1.25
+++ csh.1	1999/09/20 16:10:46
@@ -1408,6 +1408,10 @@
 names and scale factors, unambiguous prefixes
 of the names suffice.
+Limits of an arbitrary process can be displayed or set using the
+.Xr sysctl(8)
 .It Ic login
 Terminate a login shell, replacing it with an instance of
 .Pa /usr/bin/login.
@@ -2133,6 +2137,7 @@
 .Xr tty 4 ,
 .Xr a.out 5 ,
 .Xr environ 7 ,
+.Xr sysctl 8 ,
 .Em "An introduction to the C shell"
Index: bin/sh/sh.1
RCS file: /cvsroot/basesrc/bin/sh/sh.1,v
retrieving revision 1.30
diff -u -r1.30 sh.1
--- sh.1	1999/07/06 14:01:01	1.30
+++ sh.1	1999/09/20 16:10:53
@@ -1389,6 +1389,10 @@
 or set. If value is specified, the limit is set to that number; otherwise
 the current limit is displayed.
+Limits of an arbitrary process can be displayed or set using the
+.Xr sysctl 8
 .It umask Op Ar mask
 Set the value of umask (see
 .Xr umask 2 )
@@ -1500,6 +1504,7 @@
 .Xr passwd 4 ,
 .Xr profile 4 ,
 .Xr environ 5
+.Xr sysctl 8
Index: sbin/init/init.8
RCS file: /cvsroot/basesrc/sbin/init/init.8,v
retrieving revision 1.18
diff -u -r1.18 init.8
--- init.8	1998/11/14 07:47:36	1.18
+++ init.8	1999/09/20 16:10:53
@@ -116,6 +116,9 @@
 .Xr ipf 8
 (the in-kernel IP filtering facility) may not be changed.
+Users may not change the per-process core name template format, only the
+default can be changed.
 Downgrading from highly secure mode to insecure mode (that is, to single-user
 mode) always requires the root password to be entered on the console, whether
 the console is marked as 'secure' in
Index: lib/libc/gen/sysctl.3
RCS file: /cvsroot/basesrc/lib/libc/gen/sysctl.3,v
retrieving revision 1.36
diff -u -r1.36 sysctl.3
--- sysctl.3	1999/06/24 14:18:10	1.36
+++ sysctl.3	1999/09/20 16:10:55
@@ -127,6 +127,7 @@
 .It CTL\_KERN	sys/sysctl.h	High kernel limits
 .It CTL\_MACHDEP	sys/sysctl.h	Machine dependent
 .It CTL\_NET	sys/socket.h	Networking
+.It CTL\_PROC	sys/sysctl.h	Per-process
 .It CTL\_USER	sys/sysctl.h	User-level
 .It CTL\_VM	vm/vm_param.h	Virtual memory
@@ -255,6 +256,7 @@
 .It KERN\_BOOTTIME	struct timeval	no
 .It KERN\_CLOCKRATE	struct clockinfo	no
+.It KERN\_DEFCORENAME	string	yes
 .It KERN\_DOMAINNAME	string	yes
 .It KERN\_FILE	struct file	no
 .It KERN\_FSYNC	integer	no
@@ -288,7 +290,6 @@
 .It KERN\_RAWPARTITION	integer	no
 .It KERN\_SAVED\_IDS	integer	no
 .It KERN\_SECURELVL	integer	raise only
-.It KERN\_SHORTCORENAME	integer	yes
 .It KERN\_SYNCHRONIZED\_IO	integer	no
 .It KERN\_SYSVMSG	integer	no
 .It KERN\_SYSVSEM	integer	no
@@ -326,6 +327,26 @@
 This structure contains the clock, statistics clock and profiling clock
 frequencies, the number of micro-seconds per hz tick, and the clock
 skew rate.
+Default template for the name of core dumps (see also PROC_PID_CORENAME in the
+per-process variables CTL_PROC).  This can be either an absolute
+or relative path name. Format characters can be used in the template,
+preceeded by the percent character (``%''). The following characters
+are recognised as format and subsitued:
+.Bl -column "cAA" "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -offset indent
+.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
+The default value is
+.Nm %n.core
+and can be changed with the kernel configuration option
+.Cd options DEFCORENAME
+.Xr options 4 ,
+.Xr core 5 ).
 Get or set the YP domain name.
@@ -466,17 +487,6 @@
 The system security level.
 This level may be raised by processes with appropriate privilege.
 It may only be lowered by process 1.
-Whether core dumps are named 
-.Nm programname.core
-(default, value 0) or 
-.Nm core
-(value 1).
-The default value can be changed to 1 with the kernel configuration option
-.Xr options 4 ,
-.Xr core 5 ).
 Returns 1 if the POSIX 1003.1b Synchronized I/O Option is available
 on this system,
@@ -717,6 +727,76 @@
 Returns the default UDP receive buffer size.
+The string and integer information available for the CTL_PROC
+is detailed below.
+The changeable column shows whether a process with appropriate
+privilege may change the value.
+These values are per-process, and as such may change from one process
+to another. When a process is created, the default values are inherited from
+its parent. When a set-user-ID or set-group-ID binary is executed, the
+value of PROC_PID_CORENAME is reset to the system default value.
+The second level name is either the magic value PROC_CURPROC, which
+points to the current process, or the PID of the target process.
+.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" "yes" -offset indent
+.It Sy Pa Third level name	Type	Changeable
+.It PROC\_PID\_CORENAME	string	yes
+.It PROC\_PID\_LIMIT	node	not applicable
+.Bl -tag -width "123456"
+The template of the core dump file name. Modifiers are the same as for
+KERN_DEFCORENAME. The base name must either be 
+.Nm core
+or end with the suffix ``.core''.
+Return resources limits, as defined for the
+.Xr getrlimit 2
+.Xr setrlimit 2
+system calls.
+The fourth level name is one of:
+The maximum amount of cpu time (in seconds) to be used by each process.
+The largest size (in bytes) file that may be created.
+The maximum size (in bytes) of the data segment for a process;
+this defines how far a program may extend its break with the
+.Xr sbrk 2
+system call.
+The maximum size (in bytes) of the stack segment for a process;
+this defines how far a program's stack segment may be extended.
+Stack extension is performed automatically by the system.
+The largest size (in bytes)
+.Pa core
+file that may be created.
+The maximum size (in bytes) to which a process's resident set size may
+This imposes a limit on the amount of physical memory to be given to
+a process; if memory is tight, the system will prefer to take memory
+from processes that are exceeding their declared resident set size.
+The maximum size (in bytes) which a process may lock into memory
+using the
+.Xr mlock 2
+The maximum number of simultaneous processes for this user id.
+The maximum number of open files for this process.
+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.
 The string and integer information available for the CTL_USER level
 is detailed below.
Index: lib/libc/sys/getrlimit.2
RCS file: /cvsroot/basesrc/lib/libc/sys/getrlimit.2,v
retrieving revision 1.13
diff -u -r1.13 getrlimit.2
--- getrlimit.2	1999/03/22 19:45:04	1.13
+++ getrlimit.2	1999/09/20 16:10:55
@@ -54,7 +54,9 @@
 .Fn getrlimit
 call, and set with the
 .Fn setrlimit
+call.  Resources of an arbitrary process can be obtained/changed using
+.Xr sysctl 3 .
 .Fa resource