1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2000 Marcel Moolenaar 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 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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$"); 31 32 #include <sys/param.h> 33 #include <sys/capsicum.h> 34 #include <sys/fcntl.h> 35 #include <sys/file.h> 36 #include <sys/imgact.h> 37 #include <sys/lock.h> 38 #include <sys/malloc.h> 39 #include <sys/mman.h> 40 #include <sys/mutex.h> 41 #include <sys/priv.h> 42 #include <sys/proc.h> 43 #include <sys/queue.h> 44 #include <sys/resource.h> 45 #include <sys/resourcevar.h> 46 #include <sys/sched.h> 47 #include <sys/signalvar.h> 48 #include <sys/syscallsubr.h> 49 #include <sys/sysproto.h> 50 #include <sys/systm.h> 51 #include <sys/sx.h> 52 #include <sys/unistd.h> 53 #include <sys/wait.h> 54 55 #include <machine/frame.h> 56 #include <machine/psl.h> 57 #include <machine/segments.h> 58 #include <machine/sysarch.h> 59 60 #include <vm/pmap.h> 61 #include <vm/vm.h> 62 #include <vm/vm_map.h> 63 64 #include <i386/linux/linux.h> 65 #include <i386/linux/linux_proto.h> 66 #include <compat/linux/linux_emul.h> 67 #include <compat/linux/linux_ipc.h> 68 #include <compat/linux/linux_misc.h> 69 #include <compat/linux/linux_mmap.h> 70 #include <compat/linux/linux_signal.h> 71 #include <compat/linux/linux_util.h> 72 73 #include <i386/include/pcb.h> /* needed for pcb definition in linux_set_thread_area */ 74 75 #include "opt_posix.h" 76 77 extern struct sysentvec elf32_freebsd_sysvec; /* defined in i386/i386/elf_machdep.c */ 78 79 struct l_descriptor { 80 l_uint entry_number; 81 l_ulong base_addr; 82 l_uint limit; 83 l_uint seg_32bit:1; 84 l_uint contents:2; 85 l_uint read_exec_only:1; 86 l_uint limit_in_pages:1; 87 l_uint seg_not_present:1; 88 l_uint useable:1; 89 }; 90 91 struct l_old_select_argv { 92 l_int nfds; 93 l_fd_set *readfds; 94 l_fd_set *writefds; 95 l_fd_set *exceptfds; 96 struct l_timeval *timeout; 97 }; 98 99 100 int 101 linux_execve(struct thread *td, struct linux_execve_args *args) 102 { 103 struct image_args eargs; 104 char *newpath; 105 int error; 106 107 LCONVPATHEXIST(td, args->path, &newpath); 108 109 error = exec_copyin_args(&eargs, newpath, UIO_SYSSPACE, 110 args->argp, args->envp); 111 free(newpath, M_TEMP); 112 if (error == 0) 113 error = linux_common_execve(td, &eargs); 114 return (error); 115 } 116 117 struct l_ipc_kludge { 118 struct l_msgbuf *msgp; 119 l_long msgtyp; 120 }; 121 122 int 123 linux_ipc(struct thread *td, struct linux_ipc_args *args) 124 { 125 126 switch (args->what & 0xFFFF) { 127 case LINUX_SEMOP: { 128 struct linux_semop_args a; 129 130 a.semid = args->arg1; 131 a.tsops = PTRIN(args->ptr); 132 a.nsops = args->arg2; 133 return (linux_semop(td, &a)); 134 } 135 case LINUX_SEMGET: { 136 struct linux_semget_args a; 137 138 a.key = args->arg1; 139 a.nsems = args->arg2; 140 a.semflg = args->arg3; 141 return (linux_semget(td, &a)); 142 } 143 case LINUX_SEMCTL: { 144 struct linux_semctl_args a; 145 int error; 146 147 a.semid = args->arg1; 148 a.semnum = args->arg2; 149 a.cmd = args->arg3; 150 error = copyin(PTRIN(args->ptr), &a.arg, sizeof(a.arg)); 151 if (error) 152 return (error); 153 return (linux_semctl(td, &a)); 154 } 155 case LINUX_MSGSND: { 156 struct linux_msgsnd_args a; 157 158 a.msqid = args->arg1; 159 a.msgp = PTRIN(args->ptr); 160 a.msgsz = args->arg2; 161 a.msgflg = args->arg3; 162 return (linux_msgsnd(td, &a)); 163 } 164 case LINUX_MSGRCV: { 165 struct linux_msgrcv_args a; 166 167 a.msqid = args->arg1; 168 a.msgsz = args->arg2; 169 a.msgflg = args->arg3; 170 if ((args->what >> 16) == 0) { 171 struct l_ipc_kludge tmp; 172 int error; 173 174 if (args->ptr == 0) 175 return (EINVAL); 176 error = copyin(PTRIN(args->ptr), &tmp, sizeof(tmp)); 177 if (error) 178 return (error); 179 a.msgp = PTRIN(tmp.msgp); 180 a.msgtyp = tmp.msgtyp; 181 } else { 182 a.msgp = PTRIN(args->ptr); 183 a.msgtyp = args->arg5; 184 } 185 return (linux_msgrcv(td, &a)); 186 } 187 case LINUX_MSGGET: { 188 struct linux_msgget_args a; 189 190 a.key = args->arg1; 191 a.msgflg = args->arg2; 192 return (linux_msgget(td, &a)); 193 } 194 case LINUX_MSGCTL: { 195 struct linux_msgctl_args a; 196 197 a.msqid = args->arg1; 198 a.cmd = args->arg2; 199 a.buf = PTRIN(args->ptr); 200 return (linux_msgctl(td, &a)); 201 } 202 case LINUX_SHMAT: { 203 struct linux_shmat_args a; 204 l_uintptr_t addr; 205 int error; 206 207 a.shmid = args->arg1; 208 a.shmaddr = PTRIN(args->ptr); 209 a.shmflg = args->arg2; 210 error = linux_shmat(td, &a); 211 if (error != 0) 212 return (error); 213 addr = td->td_retval[0]; 214 error = copyout(&addr, PTRIN(args->arg3), sizeof(addr)); 215 td->td_retval[0] = 0; 216 return (error); 217 } 218 case LINUX_SHMDT: { 219 struct linux_shmdt_args a; 220 221 a.shmaddr = PTRIN(args->ptr); 222 return (linux_shmdt(td, &a)); 223 } 224 case LINUX_SHMGET: { 225 struct linux_shmget_args a; 226 227 a.key = args->arg1; 228 a.size = args->arg2; 229 a.shmflg = args->arg3; 230 return (linux_shmget(td, &a)); 231 } 232 case LINUX_SHMCTL: { 233 struct linux_shmctl_args a; 234 235 a.shmid = args->arg1; 236 a.cmd = args->arg2; 237 a.buf = PTRIN(args->ptr); 238 return (linux_shmctl(td, &a)); 239 } 240 default: 241 break; 242 } 243 244 return (EINVAL); 245 } 246 247 int 248 linux_old_select(struct thread *td, struct linux_old_select_args *args) 249 { 250 struct l_old_select_argv linux_args; 251 struct linux_select_args newsel; 252 int error; 253 254 error = copyin(args->ptr, &linux_args, sizeof(linux_args)); 255 if (error) 256 return (error); 257 258 newsel.nfds = linux_args.nfds; 259 newsel.readfds = linux_args.readfds; 260 newsel.writefds = linux_args.writefds; 261 newsel.exceptfds = linux_args.exceptfds; 262 newsel.timeout = linux_args.timeout; 263 return (linux_select(td, &newsel)); 264 } 265 266 int 267 linux_set_cloned_tls(struct thread *td, void *desc) 268 { 269 struct segment_descriptor sd; 270 struct l_user_desc info; 271 int idx, error; 272 int a[2]; 273 274 error = copyin(desc, &info, sizeof(struct l_user_desc)); 275 if (error) { 276 linux_msg(td, "set_cloned_tls copyin failed!"); 277 } else { 278 idx = info.entry_number; 279 280 /* 281 * looks like we're getting the idx we returned 282 * in the set_thread_area() syscall 283 */ 284 if (idx != 6 && idx != 3) { 285 linux_msg(td, "set_cloned_tls resetting idx!"); 286 idx = 3; 287 } 288 289 /* this doesnt happen in practice */ 290 if (idx == 6) { 291 /* we might copy out the entry_number as 3 */ 292 info.entry_number = 3; 293 error = copyout(&info, desc, sizeof(struct l_user_desc)); 294 if (error) 295 linux_msg(td, "set_cloned_tls copyout failed!"); 296 } 297 298 a[0] = LINUX_LDT_entry_a(&info); 299 a[1] = LINUX_LDT_entry_b(&info); 300 301 memcpy(&sd, &a, sizeof(a)); 302 /* set %gs */ 303 td->td_pcb->pcb_gsd = sd; 304 td->td_pcb->pcb_gs = GSEL(GUGS_SEL, SEL_UPL); 305 } 306 307 return (error); 308 } 309 310 int 311 linux_set_upcall_kse(struct thread *td, register_t stack) 312 { 313 314 if (stack) 315 td->td_frame->tf_esp = stack; 316 317 /* 318 * The newly created Linux thread returns 319 * to the user space by the same path that a parent do. 320 */ 321 td->td_frame->tf_eax = 0; 322 return (0); 323 } 324 325 int 326 linux_mmap2(struct thread *td, struct linux_mmap2_args *args) 327 { 328 329 return (linux_mmap_common(td, args->addr, args->len, args->prot, 330 args->flags, args->fd, (uint64_t)(uint32_t)args->pgoff * 331 PAGE_SIZE)); 332 } 333 334 int 335 linux_mmap(struct thread *td, struct linux_mmap_args *args) 336 { 337 int error; 338 struct l_mmap_argv linux_args; 339 340 error = copyin(args->ptr, &linux_args, sizeof(linux_args)); 341 if (error) 342 return (error); 343 344 return (linux_mmap_common(td, linux_args.addr, linux_args.len, 345 linux_args.prot, linux_args.flags, linux_args.fd, 346 (uint32_t)linux_args.pgoff)); 347 } 348 349 int 350 linux_mprotect(struct thread *td, struct linux_mprotect_args *uap) 351 { 352 353 return (linux_mprotect_common(td, PTROUT(uap->addr), uap->len, uap->prot)); 354 } 355 356 int 357 linux_ioperm(struct thread *td, struct linux_ioperm_args *args) 358 { 359 int error; 360 struct i386_ioperm_args iia; 361 362 iia.start = args->start; 363 iia.length = args->length; 364 iia.enable = args->enable; 365 error = i386_set_ioperm(td, &iia); 366 return (error); 367 } 368 369 int 370 linux_iopl(struct thread *td, struct linux_iopl_args *args) 371 { 372 int error; 373 374 if (args->level < 0 || args->level > 3) 375 return (EINVAL); 376 if ((error = priv_check(td, PRIV_IO)) != 0) 377 return (error); 378 if ((error = securelevel_gt(td->td_ucred, 0)) != 0) 379 return (error); 380 td->td_frame->tf_eflags = (td->td_frame->tf_eflags & ~PSL_IOPL) | 381 (args->level * (PSL_IOPL / 3)); 382 return (0); 383 } 384 385 int 386 linux_modify_ldt(struct thread *td, struct linux_modify_ldt_args *uap) 387 { 388 int error; 389 struct i386_ldt_args ldt; 390 struct l_descriptor ld; 391 union descriptor desc; 392 int size, written; 393 394 switch (uap->func) { 395 case 0x00: /* read_ldt */ 396 ldt.start = 0; 397 ldt.descs = uap->ptr; 398 ldt.num = uap->bytecount / sizeof(union descriptor); 399 error = i386_get_ldt(td, &ldt); 400 td->td_retval[0] *= sizeof(union descriptor); 401 break; 402 case 0x02: /* read_default_ldt = 0 */ 403 size = 5*sizeof(struct l_desc_struct); 404 if (size > uap->bytecount) 405 size = uap->bytecount; 406 for (written = error = 0; written < size && error == 0; written++) 407 error = subyte((char *)uap->ptr + written, 0); 408 td->td_retval[0] = written; 409 break; 410 case 0x01: /* write_ldt */ 411 case 0x11: /* write_ldt */ 412 if (uap->bytecount != sizeof(ld)) 413 return (EINVAL); 414 415 error = copyin(uap->ptr, &ld, sizeof(ld)); 416 if (error) 417 return (error); 418 419 ldt.start = ld.entry_number; 420 ldt.descs = &desc; 421 ldt.num = 1; 422 desc.sd.sd_lolimit = (ld.limit & 0x0000ffff); 423 desc.sd.sd_hilimit = (ld.limit & 0x000f0000) >> 16; 424 desc.sd.sd_lobase = (ld.base_addr & 0x00ffffff); 425 desc.sd.sd_hibase = (ld.base_addr & 0xff000000) >> 24; 426 desc.sd.sd_type = SDT_MEMRO | ((ld.read_exec_only ^ 1) << 1) | 427 (ld.contents << 2); 428 desc.sd.sd_dpl = 3; 429 desc.sd.sd_p = (ld.seg_not_present ^ 1); 430 desc.sd.sd_xx = 0; 431 desc.sd.sd_def32 = ld.seg_32bit; 432 desc.sd.sd_gran = ld.limit_in_pages; 433 error = i386_set_ldt(td, &ldt, &desc); 434 break; 435 default: 436 error = ENOSYS; 437 break; 438 } 439 440 if (error == EOPNOTSUPP) { 441 linux_msg(td, "modify_ldt needs kernel option USER_LDT"); 442 error = ENOSYS; 443 } 444 445 return (error); 446 } 447 448 int 449 linux_sigaction(struct thread *td, struct linux_sigaction_args *args) 450 { 451 l_osigaction_t osa; 452 l_sigaction_t act, oact; 453 int error; 454 455 if (args->nsa != NULL) { 456 error = copyin(args->nsa, &osa, sizeof(l_osigaction_t)); 457 if (error) 458 return (error); 459 act.lsa_handler = osa.lsa_handler; 460 act.lsa_flags = osa.lsa_flags; 461 act.lsa_restorer = osa.lsa_restorer; 462 LINUX_SIGEMPTYSET(act.lsa_mask); 463 act.lsa_mask.__mask = osa.lsa_mask; 464 } 465 466 error = linux_do_sigaction(td, args->sig, args->nsa ? &act : NULL, 467 args->osa ? &oact : NULL); 468 469 if (args->osa != NULL && !error) { 470 osa.lsa_handler = oact.lsa_handler; 471 osa.lsa_flags = oact.lsa_flags; 472 osa.lsa_restorer = oact.lsa_restorer; 473 osa.lsa_mask = oact.lsa_mask.__mask; 474 error = copyout(&osa, args->osa, sizeof(l_osigaction_t)); 475 } 476 477 return (error); 478 } 479 480 /* 481 * Linux has two extra args, restart and oldmask. We dont use these, 482 * but it seems that "restart" is actually a context pointer that 483 * enables the signal to happen with a different register set. 484 */ 485 int 486 linux_sigsuspend(struct thread *td, struct linux_sigsuspend_args *args) 487 { 488 sigset_t sigmask; 489 l_sigset_t mask; 490 491 LINUX_SIGEMPTYSET(mask); 492 mask.__mask = args->mask; 493 linux_to_bsd_sigset(&mask, &sigmask); 494 return (kern_sigsuspend(td, sigmask)); 495 } 496 497 int 498 linux_rt_sigsuspend(struct thread *td, struct linux_rt_sigsuspend_args *uap) 499 { 500 l_sigset_t lmask; 501 sigset_t sigmask; 502 int error; 503 504 if (uap->sigsetsize != sizeof(l_sigset_t)) 505 return (EINVAL); 506 507 error = copyin(uap->newset, &lmask, sizeof(l_sigset_t)); 508 if (error) 509 return (error); 510 511 linux_to_bsd_sigset(&lmask, &sigmask); 512 return (kern_sigsuspend(td, sigmask)); 513 } 514 515 int 516 linux_pause(struct thread *td, struct linux_pause_args *args) 517 { 518 struct proc *p = td->td_proc; 519 sigset_t sigmask; 520 521 PROC_LOCK(p); 522 sigmask = td->td_sigmask; 523 PROC_UNLOCK(p); 524 return (kern_sigsuspend(td, sigmask)); 525 } 526 527 int 528 linux_sigaltstack(struct thread *td, struct linux_sigaltstack_args *uap) 529 { 530 stack_t ss, oss; 531 l_stack_t lss; 532 int error; 533 534 if (uap->uss != NULL) { 535 error = copyin(uap->uss, &lss, sizeof(l_stack_t)); 536 if (error) 537 return (error); 538 539 ss.ss_sp = lss.ss_sp; 540 ss.ss_size = lss.ss_size; 541 ss.ss_flags = linux_to_bsd_sigaltstack(lss.ss_flags); 542 } 543 error = kern_sigaltstack(td, (uap->uss != NULL) ? &ss : NULL, 544 (uap->uoss != NULL) ? &oss : NULL); 545 if (!error && uap->uoss != NULL) { 546 lss.ss_sp = oss.ss_sp; 547 lss.ss_size = oss.ss_size; 548 lss.ss_flags = bsd_to_linux_sigaltstack(oss.ss_flags); 549 error = copyout(&lss, uap->uoss, sizeof(l_stack_t)); 550 } 551 552 return (error); 553 } 554 555 int 556 linux_set_thread_area(struct thread *td, struct linux_set_thread_area_args *args) 557 { 558 struct l_user_desc info; 559 int error; 560 int idx; 561 int a[2]; 562 struct segment_descriptor sd; 563 564 error = copyin(args->desc, &info, sizeof(struct l_user_desc)); 565 if (error) 566 return (error); 567 568 idx = info.entry_number; 569 /* 570 * Semantics of Linux version: every thread in the system has array of 571 * 3 tls descriptors. 1st is GLIBC TLS, 2nd is WINE, 3rd unknown. This 572 * syscall loads one of the selected tls decriptors with a value and 573 * also loads GDT descriptors 6, 7 and 8 with the content of the 574 * per-thread descriptors. 575 * 576 * Semantics of FreeBSD version: I think we can ignore that Linux has 3 577 * per-thread descriptors and use just the 1st one. The tls_array[] 578 * is used only in set/get-thread_area() syscalls and for loading the 579 * GDT descriptors. In FreeBSD we use just one GDT descriptor for TLS 580 * so we will load just one. 581 * 582 * XXX: this doesn't work when a user space process tries to use more 583 * than 1 TLS segment. Comment in the Linux sources says wine might do 584 * this. 585 */ 586 587 /* 588 * we support just GLIBC TLS now 589 * we should let 3 proceed as well because we use this segment so 590 * if code does two subsequent calls it should succeed 591 */ 592 if (idx != 6 && idx != -1 && idx != 3) 593 return (EINVAL); 594 595 /* 596 * we have to copy out the GDT entry we use 597 * FreeBSD uses GDT entry #3 for storing %gs so load that 598 * 599 * XXX: what if a user space program doesn't check this value and tries 600 * to use 6, 7 or 8? 601 */ 602 idx = info.entry_number = 3; 603 error = copyout(&info, args->desc, sizeof(struct l_user_desc)); 604 if (error) 605 return (error); 606 607 if (LINUX_LDT_empty(&info)) { 608 a[0] = 0; 609 a[1] = 0; 610 } else { 611 a[0] = LINUX_LDT_entry_a(&info); 612 a[1] = LINUX_LDT_entry_b(&info); 613 } 614 615 memcpy(&sd, &a, sizeof(a)); 616 /* this is taken from i386 version of cpu_set_user_tls() */ 617 critical_enter(); 618 /* set %gs */ 619 td->td_pcb->pcb_gsd = sd; 620 PCPU_GET(fsgs_gdt)[1] = sd; 621 load_gs(GSEL(GUGS_SEL, SEL_UPL)); 622 critical_exit(); 623 624 return (0); 625 } 626 627 int 628 linux_get_thread_area(struct thread *td, struct linux_get_thread_area_args *args) 629 { 630 631 struct l_user_desc info; 632 int error; 633 int idx; 634 struct l_desc_struct desc; 635 struct segment_descriptor sd; 636 637 error = copyin(args->desc, &info, sizeof(struct l_user_desc)); 638 if (error) 639 return (error); 640 641 idx = info.entry_number; 642 /* XXX: I am not sure if we want 3 to be allowed too. */ 643 if (idx != 6 && idx != 3) 644 return (EINVAL); 645 646 idx = 3; 647 648 memset(&info, 0, sizeof(info)); 649 650 sd = PCPU_GET(fsgs_gdt)[1]; 651 652 memcpy(&desc, &sd, sizeof(desc)); 653 654 info.entry_number = idx; 655 info.base_addr = LINUX_GET_BASE(&desc); 656 info.limit = LINUX_GET_LIMIT(&desc); 657 info.seg_32bit = LINUX_GET_32BIT(&desc); 658 info.contents = LINUX_GET_CONTENTS(&desc); 659 info.read_exec_only = !LINUX_GET_WRITABLE(&desc); 660 info.limit_in_pages = LINUX_GET_LIMIT_PAGES(&desc); 661 info.seg_not_present = !LINUX_GET_PRESENT(&desc); 662 info.useable = LINUX_GET_USEABLE(&desc); 663 664 error = copyout(&info, args->desc, sizeof(struct l_user_desc)); 665 if (error) 666 return (EFAULT); 667 668 return (0); 669 } 670 671 /* XXX: this wont work with module - convert it */ 672 int 673 linux_mq_open(struct thread *td, struct linux_mq_open_args *args) 674 { 675 #ifdef P1003_1B_MQUEUE 676 return (sys_kmq_open(td, (struct kmq_open_args *)args)); 677 #else 678 return (ENOSYS); 679 #endif 680 } 681 682 int 683 linux_mq_unlink(struct thread *td, struct linux_mq_unlink_args *args) 684 { 685 #ifdef P1003_1B_MQUEUE 686 return (sys_kmq_unlink(td, (struct kmq_unlink_args *)args)); 687 #else 688 return (ENOSYS); 689 #endif 690 } 691 692 int 693 linux_mq_timedsend(struct thread *td, struct linux_mq_timedsend_args *args) 694 { 695 #ifdef P1003_1B_MQUEUE 696 return (sys_kmq_timedsend(td, (struct kmq_timedsend_args *)args)); 697 #else 698 return (ENOSYS); 699 #endif 700 } 701 702 int 703 linux_mq_timedreceive(struct thread *td, struct linux_mq_timedreceive_args *args) 704 { 705 #ifdef P1003_1B_MQUEUE 706 return (sys_kmq_timedreceive(td, (struct kmq_timedreceive_args *)args)); 707 #else 708 return (ENOSYS); 709 #endif 710 } 711 712 int 713 linux_mq_notify(struct thread *td, struct linux_mq_notify_args *args) 714 { 715 #ifdef P1003_1B_MQUEUE 716 return (sys_kmq_notify(td, (struct kmq_notify_args *)args)); 717 #else 718 return (ENOSYS); 719 #endif 720 } 721 722 int 723 linux_mq_getsetattr(struct thread *td, struct linux_mq_getsetattr_args *args) 724 { 725 #ifdef P1003_1B_MQUEUE 726 return (sys_kmq_setattr(td, (struct kmq_setattr_args *)args)); 727 #else 728 return (ENOSYS); 729 #endif 730 } 731