uipc_mqueue.c (47bf2cf9fe86c5882b8d805f593e2def1a722f31) uipc_mqueue.c (f72b11a40c5d60b1846259cda3a7902820f23a7d)
1/*-
2 * Copyright (c) 2005 David Xu <davidxu@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

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

1833 int fd, error, len, flags, cmode;
1834
1835 if ((uap->flags & O_ACCMODE) == O_ACCMODE)
1836 return (EINVAL);
1837
1838 fdp = td->td_proc->p_fd;
1839 flags = FFLAGS(uap->flags);
1840 cmode = (((uap->mode & ~fdp->fd_cmask) & ALLPERMS) & ~S_ISTXT);
1/*-
2 * Copyright (c) 2005 David Xu <davidxu@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

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

1833 int fd, error, len, flags, cmode;
1834
1835 if ((uap->flags & O_ACCMODE) == O_ACCMODE)
1836 return (EINVAL);
1837
1838 fdp = td->td_proc->p_fd;
1839 flags = FFLAGS(uap->flags);
1840 cmode = (((uap->mode & ~fdp->fd_cmask) & ALLPERMS) & ~S_ISTXT);
1841 mq = NULL;
1841 if ((flags & O_CREAT) && (uap->attr != NULL)) {
1842 error = copyin(uap->attr, &attr, sizeof(attr));
1843 if (error)
1844 return (error);
1845 if (attr.mq_maxmsg <= 0 || attr.mq_maxmsg > maxmsg)
1846 return (EINVAL);
1847 if (attr.mq_msgsize <= 0 || attr.mq_msgsize > maxmsgsize)
1848 return (EINVAL);

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

1858 * The first character of name must be a slash (/) character
1859 * and the remaining characters of name cannot include any slash
1860 * characters.
1861 */
1862 len = strlen(path);
1863 if (len < 2 || path[0] != '/' || index(path + 1, '/') != NULL)
1864 return (EINVAL);
1865
1842 if ((flags & O_CREAT) && (uap->attr != NULL)) {
1843 error = copyin(uap->attr, &attr, sizeof(attr));
1844 if (error)
1845 return (error);
1846 if (attr.mq_maxmsg <= 0 || attr.mq_maxmsg > maxmsg)
1847 return (EINVAL);
1848 if (attr.mq_msgsize <= 0 || attr.mq_msgsize > maxmsgsize)
1849 return (EINVAL);

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

1859 * The first character of name must be a slash (/) character
1860 * and the remaining characters of name cannot include any slash
1861 * characters.
1862 */
1863 len = strlen(path);
1864 if (len < 2 || path[0] != '/' || index(path + 1, '/') != NULL)
1865 return (EINVAL);
1866
1866 fdp = td->td_proc->p_fd;
1867 error = falloc(td, &fp, &fd);
1868 if (error)
1869 return (error);
1870
1871 sx_xlock(&mqfs_data.mi_lock);
1872 pn = mqfs_search(mqfs_data.mi_root, path + 1, len - 1);
1873 if (pn == NULL) {
1874 if (!(flags & O_CREAT)) {

--- 484 unchanged lines hidden ---
1867 error = falloc(td, &fp, &fd);
1868 if (error)
1869 return (error);
1870
1871 sx_xlock(&mqfs_data.mi_lock);
1872 pn = mqfs_search(mqfs_data.mi_root, path + 1, len - 1);
1873 if (pn == NULL) {
1874 if (!(flags & O_CREAT)) {

--- 484 unchanged lines hidden ---