summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2003-06-22 22:28:56 +0000
committerRobert Watson <rwatson@FreeBSD.org>2003-06-22 22:28:56 +0000
commit4b090e41fff15ee0dd9aa055754626277ecfbda6 (patch)
treebc4b3b8a3ea1113c0b04660bb9d668ef73c73e57
parentb31745f59978785062d93b77f80027841c73b1e3 (diff)
Notes
-rw-r--r--sys/kern/kern_alq.c7
-rw-r--r--sys/kern/kern_ktr.c5
-rw-r--r--sys/sys/alq.h4
3 files changed, 10 insertions, 6 deletions
diff --git a/sys/kern/kern_alq.c b/sys/kern/kern_alq.c
index 5335393fdf01..94f0118dbb8b 100644
--- a/sys/kern/kern_alq.c
+++ b/sys/kern/kern_alq.c
@@ -326,7 +326,8 @@ SYSINIT(ald, SI_SUB_LOCK, SI_ORDER_ANY, ald_startup, NULL)
* Create the queue data structure, allocate the buffer, and open the file.
*/
int
-alq_open(struct alq **alqp, const char *file, int size, int count)
+alq_open(struct alq **alqp, const char *file, struct ucred *cred, int size,
+ int count)
{
struct thread *td;
struct nameidata nd;
@@ -344,7 +345,7 @@ alq_open(struct alq **alqp, const char *file, int size, int count)
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, file, td);
flags = FWRITE | O_NOFOLLOW | O_CREAT;
- error = vn_open(&nd, &flags, 0);
+ error = vn_open_cred(&nd, &flags, 0, cred);
if (error)
return (error);
@@ -356,7 +357,7 @@ alq_open(struct alq **alqp, const char *file, int size, int count)
alq->aq_entbuf = malloc(count * size, M_ALD, M_WAITOK|M_ZERO);
alq->aq_first = malloc(sizeof(*ale) * count, M_ALD, M_WAITOK|M_ZERO);
alq->aq_vp = nd.ni_vp;
- alq->aq_cred = crhold(td->td_ucred);
+ alq->aq_cred = crhold(cred);
alq->aq_entmax = count;
alq->aq_entlen = size;
alq->aq_entfree = alq->aq_first;
diff --git a/sys/kern/kern_ktr.c b/sys/kern/kern_ktr.c
index 27f3896a7a81..13d0526b9519 100644
--- a/sys/kern/kern_ktr.c
+++ b/sys/kern/kern_ktr.c
@@ -141,8 +141,9 @@ sysctl_debug_ktr_alq_enable(SYSCTL_HANDLER_ARGS)
error = suser(curthread);
if (error)
return (error);
- error = alq_open(&ktr_alq, (const char *)ktr_alq_file,
- sizeof(struct ktr_entry), ktr_alq_depth);
+ error = alq_open(&ktr_alq, (const char *)ktr_alq_file,
+ req->td->td_ucred, sizeof(struct ktr_entry),
+ ktr_alq_depth);
if (error == 0) {
ktr_mask &= ~KTR_ALQ_MASK;
ktr_alq_cnt = 0;
diff --git a/sys/sys/alq.h b/sys/sys/alq.h
index 1d9d75215442..98c414d028e2 100644
--- a/sys/sys/alq.h
+++ b/sys/sys/alq.h
@@ -65,7 +65,9 @@ struct ale {
* Returns:
* error from open or 0 on success
*/
-int alq_open(struct alq **, const char *file, int size, int count);
+struct ucred;
+int alq_open(struct alq **, const char *file, struct ucred *cred, int size,
+ int count);
/*
* alq_write: Write data into the queue