xref: /netbsd-src/sys/miscfs/procfs/procfs_note.c (revision 168cd830d22e1f4a4c2bde1105f9f94d40fb870d)
1*168cd830Schristos /*	$NetBSD: procfs_note.c,v 1.15 2006/11/16 01:33:38 christos Exp $	*/
2aad01611Sagc 
3aad01611Sagc /*
4aad01611Sagc  * Copyright (c) 1993
5aad01611Sagc  *	The Regents of the University of California.  All rights reserved.
6aad01611Sagc  *
7aad01611Sagc  * This code is derived from software contributed to Berkeley by
8aad01611Sagc  * Jan-Simon Pendry.
9aad01611Sagc  *
10aad01611Sagc  * Redistribution and use in source and binary forms, with or without
11aad01611Sagc  * modification, are permitted provided that the following conditions
12aad01611Sagc  * are met:
13aad01611Sagc  * 1. Redistributions of source code must retain the above copyright
14aad01611Sagc  *    notice, this list of conditions and the following disclaimer.
15aad01611Sagc  * 2. Redistributions in binary form must reproduce the above copyright
16aad01611Sagc  *    notice, this list of conditions and the following disclaimer in the
17aad01611Sagc  *    documentation and/or other materials provided with the distribution.
18aad01611Sagc  * 3. Neither the name of the University nor the names of its contributors
19aad01611Sagc  *    may be used to endorse or promote products derived from this software
20aad01611Sagc  *    without specific prior written permission.
21aad01611Sagc  *
22aad01611Sagc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23aad01611Sagc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24aad01611Sagc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25aad01611Sagc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26aad01611Sagc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27aad01611Sagc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28aad01611Sagc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29aad01611Sagc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30aad01611Sagc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31aad01611Sagc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32aad01611Sagc  * SUCH DAMAGE.
33aad01611Sagc  *
34aad01611Sagc  *	@(#)procfs_note.c	8.2 (Berkeley) 1/21/94
35aad01611Sagc  */
36cf92afd6Scgd 
37699e3be9Scgd /*
38699e3be9Scgd  * Copyright (c) 1993 Jan-Simon Pendry
39699e3be9Scgd  *
40699e3be9Scgd  * This code is derived from software contributed to Berkeley by
41699e3be9Scgd  * Jan-Simon Pendry.
42699e3be9Scgd  *
43699e3be9Scgd  * Redistribution and use in source and binary forms, with or without
44699e3be9Scgd  * modification, are permitted provided that the following conditions
45699e3be9Scgd  * are met:
46699e3be9Scgd  * 1. Redistributions of source code must retain the above copyright
47699e3be9Scgd  *    notice, this list of conditions and the following disclaimer.
48699e3be9Scgd  * 2. Redistributions in binary form must reproduce the above copyright
49699e3be9Scgd  *    notice, this list of conditions and the following disclaimer in the
50699e3be9Scgd  *    documentation and/or other materials provided with the distribution.
51699e3be9Scgd  * 3. All advertising materials mentioning features or use of this software
52699e3be9Scgd  *    must display the following acknowledgement:
53699e3be9Scgd  *	This product includes software developed by the University of
54699e3be9Scgd  *	California, Berkeley and its contributors.
55699e3be9Scgd  * 4. Neither the name of the University nor the names of its contributors
56699e3be9Scgd  *    may be used to endorse or promote products derived from this software
57699e3be9Scgd  *    without specific prior written permission.
58699e3be9Scgd  *
59699e3be9Scgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
60699e3be9Scgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
61699e3be9Scgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
62699e3be9Scgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
63699e3be9Scgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
64699e3be9Scgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
65699e3be9Scgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
66699e3be9Scgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
67699e3be9Scgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
68699e3be9Scgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
69699e3be9Scgd  * SUCH DAMAGE.
70699e3be9Scgd  *
71cf92afd6Scgd  *	@(#)procfs_note.c	8.2 (Berkeley) 1/21/94
72699e3be9Scgd  */
73699e3be9Scgd 
74e4b00f43Slukem #include <sys/cdefs.h>
75*168cd830Schristos __KERNEL_RCSID(0, "$NetBSD: procfs_note.c,v 1.15 2006/11/16 01:33:38 christos Exp $");
76e4b00f43Slukem 
77699e3be9Scgd #include <sys/param.h>
78699e3be9Scgd #include <sys/systm.h>
79699e3be9Scgd #include <sys/time.h>
80699e3be9Scgd #include <sys/kernel.h>
81699e3be9Scgd #include <sys/proc.h>
82699e3be9Scgd #include <sys/vnode.h>
83699e3be9Scgd #include <sys/signal.h>
84699e3be9Scgd #include <miscfs/procfs/procfs.h>
85699e3be9Scgd 
86cde1d475Smycroft int
procfs_donote(struct lwp * curl,struct proc * p,struct pfsnode * pfs,struct uio * uio)874d595fd7Schristos procfs_donote(
88*168cd830Schristos     struct lwp *curl,
89*168cd830Schristos     struct proc *p,
90*168cd830Schristos     struct pfsnode *pfs,
914d595fd7Schristos     struct uio *uio
924d595fd7Schristos )
93699e3be9Scgd {
94699e3be9Scgd 	int xlen;
95699e3be9Scgd 	int error;
96699e3be9Scgd 	char note[PROCFS_NOTELEN+1];
97699e3be9Scgd 
98699e3be9Scgd 	if (uio->uio_rw != UIO_WRITE)
99699e3be9Scgd 		return (EINVAL);
100699e3be9Scgd 
101699e3be9Scgd 	xlen = PROCFS_NOTELEN;
102cde1d475Smycroft 	error = vfs_getuserstr(uio, note, &xlen);
103699e3be9Scgd 	if (error)
104699e3be9Scgd 		return (error);
105699e3be9Scgd 
106cde1d475Smycroft 	/* send to process's notify function */
107cde1d475Smycroft 	return (EOPNOTSUPP);
108699e3be9Scgd }
109