Deleted Added
full compact
procfs_type.c (83366) procfs_type.c (87321)
1/*
2 * Copyright (c) 1993 Jan-Simon Pendry
3 * Copyright (c) 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Jan-Simon Pendry.
8 *

--- 20 unchanged lines hidden (view full) ---

29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
1/*
2 * Copyright (c) 1993 Jan-Simon Pendry
3 * Copyright (c) 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Jan-Simon Pendry.
8 *

--- 20 unchanged lines hidden (view full) ---

29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * $FreeBSD: head/sys/fs/procfs/procfs_type.c 83366 2001-09-12 08:38:13Z julian $
37 * $FreeBSD: head/sys/fs/procfs/procfs_type.c 87321 2001-12-04 01:35:06Z des $
38 */
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/proc.h>
38 */
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/proc.h>
43#include <sys/sbuf.h>
43#include <sys/sysent.h>
44#include <sys/sysent.h>
44#include <sys/vnode.h>
45
46#include <fs/pseudofs/pseudofs.h>
45#include <fs/procfs/procfs.h>
46
47int
47#include <fs/procfs/procfs.h>
48
49int
48procfs_dotype(curp, p, pfs, uio)
49 struct proc *curp;
50 struct proc *p;
51 struct pfsnode *pfs;
52 struct uio *uio;
50procfs_doproctype(PFS_FILL_ARGS)
53{
51{
54 int len;
55 int error;
56 /*
57 * buffer for emulation type
58 */
59 char mebuffer[256];
60 char *none = "Not Available";
52 static const char *none = "Not Available";
61
53
62 if (uio->uio_rw != UIO_READ)
63 return (EOPNOTSUPP);
64
65 if (uio->uio_offset != 0)
66 return (0);
67
68 if (p && p->p_sysent && p->p_sysent->sv_name) {
54 if (p && p->p_sysent && p->p_sysent->sv_name) {
69 len = strlen(p->p_sysent->sv_name);
70 bcopy(p->p_sysent->sv_name, mebuffer, len);
55 sbuf_printf(sb, p->p_sysent->sv_name);
71 } else {
56 } else {
72 len = strlen(none);
73 bcopy(none, mebuffer, len);
57 sbuf_printf(sb, none);
74 }
58 }
75 mebuffer[len++] = '\n';
76 error = uiomove(mebuffer, len, uio);
77 return error;
59 sbuf_putc(sb, '\n');
60 return (0);
78}
61}
79
80int
81procfs_validtype(struct thread *td)
82{
83 return ((td->td_proc->p_flag & P_SYSTEM) == 0);
84}