Deleted Added
full compact
linux_file.c (330997) linux_file.c (346816)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 1994-1995 S��ren Schmidt
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 1994-1995 S��ren Schmidt
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: stable/11/sys/compat/linux/linux_file.c 330997 2018-03-15 12:56:22Z emaste $");
30__FBSDID("$FreeBSD: stable/11/sys/compat/linux/linux_file.c 346816 2019-04-28 13:19:28Z dchagin $");
31
32#include "opt_compat.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/capsicum.h>
37#include <sys/conf.h>
38#include <sys/dirent.h>

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

533 */
534
535int
536linux_access(struct thread *td, struct linux_access_args *args)
537{
538 char *path;
539 int error;
540
31
32#include "opt_compat.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/capsicum.h>
37#include <sys/conf.h>
38#include <sys/dirent.h>

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

533 */
534
535int
536linux_access(struct thread *td, struct linux_access_args *args)
537{
538 char *path;
539 int error;
540
541 /* linux convention */
541 /* Linux convention. */
542 if (args->amode & ~(F_OK | X_OK | W_OK | R_OK))
543 return (EINVAL);
544
545 LCONVPATHEXIST(td, args->path, &path);
546
547#ifdef DEBUG
548 if (ldebug(access))
549 printf(ARGS(access, "%s, %d"), path, args->amode);

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

556}
557
558int
559linux_faccessat(struct thread *td, struct linux_faccessat_args *args)
560{
561 char *path;
562 int error, dfd;
563
542 if (args->amode & ~(F_OK | X_OK | W_OK | R_OK))
543 return (EINVAL);
544
545 LCONVPATHEXIST(td, args->path, &path);
546
547#ifdef DEBUG
548 if (ldebug(access))
549 printf(ARGS(access, "%s, %d"), path, args->amode);

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

556}
557
558int
559linux_faccessat(struct thread *td, struct linux_faccessat_args *args)
560{
561 char *path;
562 int error, dfd;
563
564 /* linux convention */
564 /* Linux convention. */
565 if (args->amode & ~(F_OK | X_OK | W_OK | R_OK))
566 return (EINVAL);
567
568 dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
569 LCONVPATHEXIST_AT(td, args->filename, &path, dfd);
570
571#ifdef DEBUG
572 if (ldebug(access))

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

999linux_pread(struct thread *td, struct linux_pread_args *uap)
1000{
1001 cap_rights_t rights;
1002 struct vnode *vp;
1003 int error;
1004
1005 error = kern_pread(td, uap->fd, uap->buf, uap->nbyte, uap->offset);
1006 if (error == 0) {
565 if (args->amode & ~(F_OK | X_OK | W_OK | R_OK))
566 return (EINVAL);
567
568 dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
569 LCONVPATHEXIST_AT(td, args->filename, &path, dfd);
570
571#ifdef DEBUG
572 if (ldebug(access))

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

999linux_pread(struct thread *td, struct linux_pread_args *uap)
1000{
1001 cap_rights_t rights;
1002 struct vnode *vp;
1003 int error;
1004
1005 error = kern_pread(td, uap->fd, uap->buf, uap->nbyte, uap->offset);
1006 if (error == 0) {
1007 /* This seems to violate POSIX but linux does it */
1007 /* This seems to violate POSIX but Linux does it. */
1008 error = fgetvp(td, uap->fd,
1009 cap_rights_init(&rights, CAP_PREAD), &vp);
1010 if (error != 0)
1011 return (error);
1012 if (vp->v_type == VDIR) {
1013 vrele(vp);
1014 return (EISDIR);
1015 }

--- 656 unchanged lines hidden ---
1008 error = fgetvp(td, uap->fd,
1009 cap_rights_init(&rights, CAP_PREAD), &vp);
1010 if (error != 0)
1011 return (error);
1012 if (vp->v_type == VDIR) {
1013 vrele(vp);
1014 return (EISDIR);
1015 }

--- 656 unchanged lines hidden ---