kern_alq.c (9454b2d864463f856c6aaf147851104b25cf4037) kern_alq.c (e551d452112c5aa9e36b55316981901967237037)
1/*-
2 * Copyright (c) 2002, Jeffrey Roberson <jeff@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

329
330
331/* User visible queue functions */
332
333/*
334 * Create the queue data structure, allocate the buffer, and open the file.
335 */
336int
1/*-
2 * Copyright (c) 2002, Jeffrey Roberson <jeff@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

329
330
331/* User visible queue functions */
332
333/*
334 * Create the queue data structure, allocate the buffer, and open the file.
335 */
336int
337alq_open(struct alq **alqp, const char *file, struct ucred *cred, int size,
338 int count)
337alq_open(struct alq **alqp, const char *file, struct ucred *cred, int cmode,
338 int size, int count)
339{
340 struct thread *td;
341 struct nameidata nd;
342 struct ale *ale;
343 struct ale *alp;
344 struct alq *alq;
345 char *bufp;
346 int flags;
347 int error;
348 int i;
349
350 *alqp = NULL;
351 td = curthread;
352
353 NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, file, td);
354 flags = FWRITE | O_NOFOLLOW | O_CREAT;
355
339{
340 struct thread *td;
341 struct nameidata nd;
342 struct ale *ale;
343 struct ale *alp;
344 struct alq *alq;
345 char *bufp;
346 int flags;
347 int error;
348 int i;
349
350 *alqp = NULL;
351 td = curthread;
352
353 NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, file, td);
354 flags = FWRITE | O_NOFOLLOW | O_CREAT;
355
356 error = vn_open_cred(&nd, &flags, 0, cred, -1);
356 error = vn_open_cred(&nd, &flags, cmode, cred, -1);
357 if (error)
358 return (error);
359
360 NDFREE(&nd, NDF_ONLY_PNBUF);
361 /* We just unlock so we hold a reference */
362 VOP_UNLOCK(nd.ni_vp, 0, td);
363
364 alq = malloc(sizeof(*alq), M_ALD, M_WAITOK|M_ZERO);

--- 150 unchanged lines hidden ---
357 if (error)
358 return (error);
359
360 NDFREE(&nd, NDF_ONLY_PNBUF);
361 /* We just unlock so we hold a reference */
362 VOP_UNLOCK(nd.ni_vp, 0, td);
363
364 alq = malloc(sizeof(*alq), M_ALD, M_WAITOK|M_ZERO);

--- 150 unchanged lines hidden ---