Add two sysctls: kern.labelsector and kern.labeloffset.
These are of use to userland code which previously depended on the hard-coded values of LABELSECTOR and LABELOFFSET to figure out the location of the disklabel for a particular platform. With the introduction of umbrella ports such as evbarm, evbmips, etc, the location of the disklabel may vary between kernels for the same MACHINE. This sysctl will allow userland programs to remain independent of the particular flavour of MACHINE in such cases.
This commit is contained in:
parent
36109bbc9c
commit
39a5a9dc76
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: sysctl.3,v 1.101 2002/11/07 12:11:00 wiz Exp $
|
||||
.\" $NetBSD: sysctl.3,v 1.102 2002/12/11 12:59:33 scw Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -289,6 +289,8 @@ information.
|
|||
.It KERN\_HOSTNAME string yes
|
||||
.It KERN\_IOV\_MAX integer no
|
||||
.It KERN\_JOB\_CONTROL integer no
|
||||
.It KERN\_LABELOFFSET integer no
|
||||
.It KERN\_LABELSECTOR integer no
|
||||
.It KERN\_LOGIN\_NAME\_MAX integer no
|
||||
.It KERN\_LOGSIGEXIT integer yes
|
||||
.It KERN\_MAPPED\_FILES integer no
|
||||
|
@ -403,6 +405,12 @@ and
|
|||
.Xr writev 2 .
|
||||
.It Li KERN_JOB_CONTROL
|
||||
Return 1 if job control is available on this system, otherwise 0.
|
||||
.It Li KERN_LABELOFFSET
|
||||
The offset within the sector specified by KERN_LABELSECTOR of the
|
||||
.Xr disklabel 5 .
|
||||
.It Li KERN_LABELSECTOR
|
||||
The sector number containing the
|
||||
.Xr disklabel 5 .
|
||||
.It Li KERN_LOGIN_NAME_MAX
|
||||
The size of the storage required for a login name, in bytes,
|
||||
including the terminating NUL.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: sysctl.8,v 1.82 2002/11/07 00:22:31 manu Exp $
|
||||
.\" $NetBSD: sysctl.8,v 1.83 2002/12/11 12:59:29 scw Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -185,6 +185,8 @@ privilege can change the value.
|
|||
.It kern.hostname string yes
|
||||
.It kern.iov_max integer no
|
||||
.It kern.job_control integer no
|
||||
.It kern.labeloffset integer no
|
||||
.It kern.labelsector integer no
|
||||
.It kern.link_max integer no
|
||||
.It kern.login_name_max integer no
|
||||
.It kern.logsigexit integer yes
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_sysctl.c,v 1.118 2002/11/24 11:37:56 scw Exp $ */
|
||||
/* $NetBSD: kern_sysctl.c,v 1.119 2002/12/11 12:59:31 scw Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
|
@ -43,7 +43,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.118 2002/11/24 11:37:56 scw Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.119 2002/12/11 12:59:31 scw Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_insecure.h"
|
||||
|
@ -586,6 +586,10 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
|
|||
#else
|
||||
return (EOPNOTSUPP);
|
||||
#endif
|
||||
case KERN_LABELSECTOR:
|
||||
return (sysctl_rdint(oldp, oldlenp, newp, LABELSECTOR));
|
||||
case KERN_LABELOFFSET:
|
||||
return (sysctl_rdint(oldp, oldlenp, newp, LABELOFFSET));
|
||||
default:
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sysctl.h,v 1.81 2002/11/17 19:54:59 manu Exp $ */
|
||||
/* $NetBSD: sysctl.h,v 1.82 2002/12/11 12:59:32 scw Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -184,7 +184,9 @@ struct ctlname {
|
|||
#ifndef _KERNEL
|
||||
#define KERN_ARND KERN_URND /* compat w/ openbsd */
|
||||
#endif
|
||||
#define KERN_MAXID 62 /* number of valid kern ids */
|
||||
#define KERN_LABELSECTOR 62 /* int: disklabel sector */
|
||||
#define KERN_LABELOFFSET 63 /* int: offset of label within sector */
|
||||
#define KERN_MAXID 63 /* number of valid kern ids */
|
||||
|
||||
#define CTL_KERN_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
|
@ -249,6 +251,8 @@ struct ctlname {
|
|||
{ "tkstat", CTLTYPE_NODE }, \
|
||||
{ "monotonic_clock", CTLTYPE_INT }, \
|
||||
{ "urandom", CTLTYPE_INT }, \
|
||||
{ "labelsector", CTLTYPE_INT }, \
|
||||
{ "labeloffset", CTLTYPE_INT }, \
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue