svr4_fcntl.c revision 89319
1166065Spjd/* 2166065Spjd * Copyright (c) 1998 Mark Newton 3166065Spjd * Copyright (c) 1994, 1997 Christos Zoulas. 4166065Spjd * All rights reserved. 5166065Spjd * 6166065Spjd * Redistribution and use in source and binary forms, with or without 7166065Spjd * modification, are permitted provided that the following conditions 8166065Spjd * are met: 9211474Spjd * 1. Redistributions of source code must retain the above copyright 10166065Spjd * notice, this list of conditions and the following disclaimer. 11166065Spjd * 2. Redistributions in binary form must reproduce the above copyright 12166065Spjd * notice, this list of conditions and the following disclaimer in the 13166065Spjd * documentation and/or other materials provided with the distribution. 14166065Spjd * 3. All advertising materials mentioning features or use of this software 15211474Spjd * must display the following acknowledgement: 16211474Spjd * This product includes software developed by Christos Zoulas. 17211474Spjd * 4. The name of the author may not be used to endorse or promote products 18211474Spjd * derived from this software without specific prior written permission. 19211474Spjd * 20166065Spjd * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * 31 * $FreeBSD: head/sys/compat/svr4/svr4_fcntl.c 89319 2002-01-14 00:13:45Z alfred $ 32 */ 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/file.h> 36#include <sys/filedesc.h> 37/*#include <sys/ioctl.h>*/ 38#include <sys/lock.h> 39#include <sys/mount.h> 40#include <sys/mutex.h> 41#include <sys/namei.h> 42#include <sys/proc.h> 43#include <sys/stat.h> 44#include <sys/unistd.h> 45#include <sys/vnode.h> 46 47#include <sys/sysproto.h> 48 49#include <compat/svr4/svr4.h> 50#include <compat/svr4/svr4_types.h> 51#include <compat/svr4/svr4_signal.h> 52#include <compat/svr4/svr4_proto.h> 53#include <compat/svr4/svr4_util.h> 54#include <compat/svr4/svr4_fcntl.h> 55 56static int svr4_to_bsd_flags __P((int)); 57static u_long svr4_to_bsd_cmd __P((u_long)); 58static int fd_revoke __P((struct thread *, int)); 59static int fd_truncate __P((struct thread *, int, struct flock *)); 60static int bsd_to_svr4_flags __P((int)); 61static void bsd_to_svr4_flock __P((struct flock *, struct svr4_flock *)); 62static void svr4_to_bsd_flock __P((struct svr4_flock *, struct flock *)); 63static void bsd_to_svr4_flock64 __P((struct flock *, struct svr4_flock64 *)); 64static void svr4_to_bsd_flock64 __P((struct svr4_flock64 *, struct flock *)); 65 66static u_long 67svr4_to_bsd_cmd(cmd) 68 u_long cmd; 69{ 70 switch (cmd) { 71 case SVR4_F_DUPFD: 72 return F_DUPFD; 73 case SVR4_F_GETFD: 74 return F_GETFD; 75 case SVR4_F_SETFD: 76 return F_SETFD; 77 case SVR4_F_GETFL: 78 return F_GETFL; 79 case SVR4_F_SETFL: 80 return F_SETFL; 81 case SVR4_F_GETLK: 82 return F_GETLK; 83 case SVR4_F_SETLK: 84 return F_SETLK; 85 case SVR4_F_SETLKW: 86 return F_SETLKW; 87 default: 88 return -1; 89 } 90} 91 92static int 93svr4_to_bsd_flags(l) 94 int l; 95{ 96 int r = 0; 97 r |= (l & SVR4_O_RDONLY) ? O_RDONLY : 0; 98 r |= (l & SVR4_O_WRONLY) ? O_WRONLY : 0; 99 r |= (l & SVR4_O_RDWR) ? O_RDWR : 0; 100 r |= (l & SVR4_O_NDELAY) ? O_NONBLOCK : 0; 101 r |= (l & SVR4_O_APPEND) ? O_APPEND : 0; 102 r |= (l & SVR4_O_SYNC) ? O_FSYNC : 0; 103 r |= (l & SVR4_O_NONBLOCK) ? O_NONBLOCK : 0; 104 r |= (l & SVR4_O_PRIV) ? O_EXLOCK : 0; 105 r |= (l & SVR4_O_CREAT) ? O_CREAT : 0; 106 r |= (l & SVR4_O_TRUNC) ? O_TRUNC : 0; 107 r |= (l & SVR4_O_EXCL) ? O_EXCL : 0; 108 r |= (l & SVR4_O_NOCTTY) ? O_NOCTTY : 0; 109 return r; 110} 111 112static int 113bsd_to_svr4_flags(l) 114 int l; 115{ 116 int r = 0; 117 r |= (l & O_RDONLY) ? SVR4_O_RDONLY : 0; 118 r |= (l & O_WRONLY) ? SVR4_O_WRONLY : 0; 119 r |= (l & O_RDWR) ? SVR4_O_RDWR : 0; 120 r |= (l & O_NDELAY) ? SVR4_O_NONBLOCK : 0; 121 r |= (l & O_APPEND) ? SVR4_O_APPEND : 0; 122 r |= (l & O_FSYNC) ? SVR4_O_SYNC : 0; 123 r |= (l & O_NONBLOCK) ? SVR4_O_NONBLOCK : 0; 124 r |= (l & O_EXLOCK) ? SVR4_O_PRIV : 0; 125 r |= (l & O_CREAT) ? SVR4_O_CREAT : 0; 126 r |= (l & O_TRUNC) ? SVR4_O_TRUNC : 0; 127 r |= (l & O_EXCL) ? SVR4_O_EXCL : 0; 128 r |= (l & O_NOCTTY) ? SVR4_O_NOCTTY : 0; 129 return r; 130} 131 132 133static void 134bsd_to_svr4_flock(iflp, oflp) 135 struct flock *iflp; 136 struct svr4_flock *oflp; 137{ 138 switch (iflp->l_type) { 139 case F_RDLCK: 140 oflp->l_type = SVR4_F_RDLCK; 141 break; 142 case F_WRLCK: 143 oflp->l_type = SVR4_F_WRLCK; 144 break; 145 case F_UNLCK: 146 oflp->l_type = SVR4_F_UNLCK; 147 break; 148 default: 149 oflp->l_type = -1; 150 break; 151 } 152 153 oflp->l_whence = (short) iflp->l_whence; 154 oflp->l_start = (svr4_off_t) iflp->l_start; 155 oflp->l_len = (svr4_off_t) iflp->l_len; 156 oflp->l_sysid = 0; 157 oflp->l_pid = (svr4_pid_t) iflp->l_pid; 158} 159 160 161static void 162svr4_to_bsd_flock(iflp, oflp) 163 struct svr4_flock *iflp; 164 struct flock *oflp; 165{ 166 switch (iflp->l_type) { 167 case SVR4_F_RDLCK: 168 oflp->l_type = F_RDLCK; 169 break; 170 case SVR4_F_WRLCK: 171 oflp->l_type = F_WRLCK; 172 break; 173 case SVR4_F_UNLCK: 174 oflp->l_type = F_UNLCK; 175 break; 176 default: 177 oflp->l_type = -1; 178 break; 179 } 180 181 oflp->l_whence = iflp->l_whence; 182 oflp->l_start = (off_t) iflp->l_start; 183 oflp->l_len = (off_t) iflp->l_len; 184 oflp->l_pid = (pid_t) iflp->l_pid; 185 186} 187 188static void 189bsd_to_svr4_flock64(iflp, oflp) 190 struct flock *iflp; 191 struct svr4_flock64 *oflp; 192{ 193 switch (iflp->l_type) { 194 case F_RDLCK: 195 oflp->l_type = SVR4_F_RDLCK; 196 break; 197 case F_WRLCK: 198 oflp->l_type = SVR4_F_WRLCK; 199 break; 200 case F_UNLCK: 201 oflp->l_type = SVR4_F_UNLCK; 202 break; 203 default: 204 oflp->l_type = -1; 205 break; 206 } 207 208 oflp->l_whence = (short) iflp->l_whence; 209 oflp->l_start = (svr4_off64_t) iflp->l_start; 210 oflp->l_len = (svr4_off64_t) iflp->l_len; 211 oflp->l_sysid = 0; 212 oflp->l_pid = (svr4_pid_t) iflp->l_pid; 213} 214 215 216static void 217svr4_to_bsd_flock64(iflp, oflp) 218 struct svr4_flock64 *iflp; 219 struct flock *oflp; 220{ 221 switch (iflp->l_type) { 222 case SVR4_F_RDLCK: 223 oflp->l_type = F_RDLCK; 224 break; 225 case SVR4_F_WRLCK: 226 oflp->l_type = F_WRLCK; 227 break; 228 case SVR4_F_UNLCK: 229 oflp->l_type = F_UNLCK; 230 break; 231 default: 232 oflp->l_type = -1; 233 break; 234 } 235 236 oflp->l_whence = iflp->l_whence; 237 oflp->l_start = (off_t) iflp->l_start; 238 oflp->l_len = (off_t) iflp->l_len; 239 oflp->l_pid = (pid_t) iflp->l_pid; 240 241} 242 243 244static int 245fd_revoke(td, fd) 246 struct thread *td; 247 int fd; 248{ 249 struct vnode *vp; 250 struct mount *mp; 251 struct vattr vattr; 252 int error, *retval; 253 254 retval = td->td_retval; 255 if ((error = fgetvp(td, fd, &vp)) != 0) 256 return (error); 257 258 if (vp->v_type != VCHR && vp->v_type != VBLK) { 259 error = EINVAL; 260 goto out; 261 } 262 263 if ((error = VOP_GETATTR(vp, &vattr, td->td_proc->p_ucred, td)) != 0) 264 goto out; 265 266 if (td->td_proc->p_ucred->cr_uid != vattr.va_uid && 267 (error = suser_td(td)) != 0) 268 goto out; 269 270 if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) 271 goto out; 272 if (vcount(vp) > 1) 273 VOP_REVOKE(vp, REVOKEALL); 274 vn_finished_write(mp); 275out: 276 vrele(vp); 277 return error; 278} 279 280 281static int 282fd_truncate(td, fd, flp) 283 struct thread *td; 284 int fd; 285 struct flock *flp; 286{ 287 off_t start, length; 288 struct vnode *vp; 289 struct vattr vattr; 290 int error, *retval; 291 struct ftruncate_args ft; 292 293 retval = td->td_retval; 294 295 /* 296 * We only support truncating the file. 297 */ 298 if ((error = fgetvp(td, uap->fd, &vp)) != 0) 299 return (error); 300 301 if (vp->v_type == VFIFO) { 302 vrele(vp); 303 return ESPIPE; 304 } 305 306 if ((error = VOP_GETATTR(vp, &vattr, td->td_proc->p_ucred, td)) != 0) 307 vrele(vp); 308 return error; 309 } 310 311 length = vattr.va_size; 312 313 switch (flp->l_whence) { 314 case SEEK_CUR: 315 start = fp->f_offset + flp->l_start; 316 break; 317 318 case SEEK_END: 319 start = flp->l_start + length; 320 break; 321 322 case SEEK_SET: 323 start = flp->l_start; 324 break; 325 326 default: 327 vrele(vp); 328 return EINVAL; 329 } 330 331 if (start + flp->l_len < length) { 332 /* We don't support free'ing in the middle of the file */ 333 return EINVAL; 334 } 335 336 SCARG(&ft, fd) = fd; 337 SCARG(&ft, length) = start; 338 339 error = ftruncate(td, &ft); 340 341 vrele(vp); 342 return (error); 343} 344 345int 346svr4_sys_open(td, uap) 347 register struct thread *td; 348 struct svr4_sys_open_args *uap; 349{ 350 struct proc *p = td->td_proc; 351 int error, retval; 352 struct open_args cup; 353 354 caddr_t sg = stackgap_init(); 355 CHECKALTEXIST(td, &sg, SCARG(uap, path)); 356 357 (&cup)->path = uap->path; 358 (&cup)->flags = svr4_to_bsd_flags(uap->flags); 359 (&cup)->mode = uap->mode; 360 error = open(td, &cup); 361 362 if (error) { 363 /* uprintf("svr4_open(%s, 0x%0x, 0%o): %d\n", uap->path, 364 uap->flags, uap->mode, error);*/ 365 return error; 366 } 367 368 retval = td->td_retval[0]; 369 370 PROC_LOCK(p); 371 if (!(SCARG(&cup, flags) & O_NOCTTY) && SESS_LEADER(p) && 372 !(td->td_proc->p_flag & P_CONTROLT)) { 373#if defined(NOTYET) 374 struct file *fp; 375 376 error = fget(td, retval, &fp); 377 PROC_UNLOCK(p); 378 /* 379 * we may have lost a race the above open() and 380 * another thread issuing a close() 381 */ 382 if (error) 383 return (EBADF); /* XXX: correct errno? */ 384 /* ignore any error, just give it a try */ 385 if (fp->f_type == DTYPE_VNODE) 386 fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, td); 387 fdrop(fp, td); 388 } else { 389 PROC_UNLOCK(p); 390 } 391#else 392 } 393 PROC_UNLOCK(p); 394#endif 395 return error; 396} 397 398int 399svr4_sys_open64(td, uap) 400 register struct thread *td; 401 struct svr4_sys_open64_args *uap; 402{ 403 return svr4_sys_open(td, (struct svr4_sys_open_args *)uap); 404} 405 406int 407svr4_sys_creat(td, uap) 408 register struct thread *td; 409 struct svr4_sys_creat_args *uap; 410{ 411 struct open_args cup; 412 413 caddr_t sg = stackgap_init(); 414 CHECKALTEXIST(td, &sg, SCARG(uap, path)); 415 416 SCARG(&cup, path) = SCARG(uap, path); 417 SCARG(&cup, mode) = SCARG(uap, mode); 418 SCARG(&cup, flags) = O_WRONLY | O_CREAT | O_TRUNC; 419 420 return open(td, &cup); 421} 422 423int 424svr4_sys_creat64(td, uap) 425 register struct thread *td; 426 struct svr4_sys_creat64_args *uap; 427{ 428 return svr4_sys_creat(td, (struct svr4_sys_creat_args *)uap); 429} 430 431int 432svr4_sys_llseek(td, uap) 433 register struct thread *td; 434 struct svr4_sys_llseek_args *uap; 435{ 436 struct lseek_args ap; 437 438 SCARG(&ap, fd) = SCARG(uap, fd); 439 440#if BYTE_ORDER == BIG_ENDIAN 441 SCARG(&ap, offset) = (((u_int64_t) SCARG(uap, offset1)) << 32) | 442 SCARG(uap, offset2); 443#else 444 SCARG(&ap, offset) = (((u_int64_t) SCARG(uap, offset2)) << 32) | 445 SCARG(uap, offset1); 446#endif 447 SCARG(&ap, whence) = SCARG(uap, whence); 448 449 return lseek(td, &ap); 450} 451 452int 453svr4_sys_access(td, uap) 454 register struct thread *td; 455 struct svr4_sys_access_args *uap; 456{ 457 struct access_args cup; 458 int *retval; 459 460 caddr_t sg = stackgap_init(); 461 CHECKALTEXIST(td, &sg, SCARG(uap, path)); 462 463 retval = td->td_retval; 464 465 SCARG(&cup, path) = SCARG(uap, path); 466 SCARG(&cup, flags) = SCARG(uap, flags); 467 468 return access(td, &cup); 469} 470 471#if defined(NOTYET) 472int 473svr4_sys_pread(td, uap) 474 register struct thread *td; 475 struct svr4_sys_pread_args *uap; 476{ 477 struct pread_args pra; 478 479 /* 480 * Just translate the args structure and call the NetBSD 481 * pread(2) system call (offset type is 64-bit in NetBSD). 482 */ 483 SCARG(&pra, fd) = SCARG(uap, fd); 484 SCARG(&pra, buf) = SCARG(uap, buf); 485 SCARG(&pra, nbyte) = SCARG(uap, nbyte); 486 SCARG(&pra, offset) = SCARG(uap, off); 487 488 return pread(td, &pra); 489} 490#endif 491 492#if defined(NOTYET) 493int 494svr4_sys_pread64(td, v, retval) 495 register struct thread *td; 496 void *v; 497 register_t *retval; 498{ 499 500 struct svr4_sys_pread64_args *uap = v; 501 struct sys_pread_args pra; 502 503 /* 504 * Just translate the args structure and call the NetBSD 505 * pread(2) system call (offset type is 64-bit in NetBSD). 506 */ 507 SCARG(&pra, fd) = SCARG(uap, fd); 508 SCARG(&pra, buf) = SCARG(uap, buf); 509 SCARG(&pra, nbyte) = SCARG(uap, nbyte); 510 SCARG(&pra, offset) = SCARG(uap, off); 511 512 return (sys_pread(td, &pra, retval)); 513} 514#endif /* NOTYET */ 515 516#if defined(NOTYET) 517int 518svr4_sys_pwrite(td, uap) 519 register struct thread *td; 520 struct svr4_sys_pwrite_args *uap; 521{ 522 struct pwrite_args pwa; 523 524 /* 525 * Just translate the args structure and call the NetBSD 526 * pwrite(2) system call (offset type is 64-bit in NetBSD). 527 */ 528 SCARG(&pwa, fd) = SCARG(uap, fd); 529 SCARG(&pwa, buf) = SCARG(uap, buf); 530 SCARG(&pwa, nbyte) = SCARG(uap, nbyte); 531 SCARG(&pwa, offset) = SCARG(uap, off); 532 533 return pwrite(td, &pwa); 534} 535#endif 536 537#if defined(NOTYET) 538int 539svr4_sys_pwrite64(td, v, retval) 540 register struct thread *td; 541 void *v; 542 register_t *retval; 543{ 544 struct svr4_sys_pwrite64_args *uap = v; 545 struct sys_pwrite_args pwa; 546 547 /* 548 * Just translate the args structure and call the NetBSD 549 * pwrite(2) system call (offset type is 64-bit in NetBSD). 550 */ 551 SCARG(&pwa, fd) = SCARG(uap, fd); 552 SCARG(&pwa, buf) = SCARG(uap, buf); 553 SCARG(&pwa, nbyte) = SCARG(uap, nbyte); 554 SCARG(&pwa, offset) = SCARG(uap, off); 555 556 return (sys_pwrite(td, &pwa, retval)); 557} 558#endif /* NOTYET */ 559 560int 561svr4_sys_fcntl(td, uap) 562 register struct thread *td; 563 struct svr4_sys_fcntl_args *uap; 564{ 565 int error; 566 struct fcntl_args fa; 567 int *retval; 568 569 retval = td->td_retval; 570 571 SCARG(&fa, fd) = SCARG(uap, fd); 572 SCARG(&fa, cmd) = svr4_to_bsd_cmd(SCARG(uap, cmd)); 573 574 switch (SCARG(&fa, cmd)) { 575 case F_DUPFD: 576 case F_GETFD: 577 case F_SETFD: 578 SCARG(&fa, arg) = (long) SCARG(uap, arg); 579 return fcntl(td, &fa); 580 581 case F_GETFL: 582 SCARG(&fa, arg) = (long) SCARG(uap, arg); 583 error = fcntl(td, &fa); 584 if (error) 585 return error; 586 *retval = bsd_to_svr4_flags(*retval); 587 return error; 588 589 case F_SETFL: 590 { 591 /* 592 * we must save the O_ASYNC flag, as that is 593 * handled by ioctl(_, I_SETSIG, _) emulation. 594 */ 595 long cmd; 596 int flags; 597 598 DPRINTF(("Setting flags %p\n", SCARG(uap, arg))); 599 cmd = SCARG(&fa, cmd); /* save it for a while */ 600 601 SCARG(&fa, cmd) = F_GETFL; 602 if ((error = fcntl(td, &fa)) != 0) 603 return error; 604 flags = *retval; 605 flags &= O_ASYNC; 606 flags |= svr4_to_bsd_flags((u_long) SCARG(uap, arg)); 607 SCARG(&fa, cmd) = cmd; 608 SCARG(&fa, arg) = (long) flags; 609 return fcntl(td, &fa); 610 } 611 612 case F_GETLK: 613 case F_SETLK: 614 case F_SETLKW: 615 { 616 struct svr4_flock ifl; 617 struct flock *flp, fl; 618 caddr_t sg = stackgap_init(); 619 620 flp = stackgap_alloc(&sg, sizeof(struct flock)); 621 SCARG(&fa, arg) = (long) flp; 622 623 error = copyin(SCARG(uap, arg), &ifl, sizeof ifl); 624 if (error) 625 return error; 626 627 svr4_to_bsd_flock(&ifl, &fl); 628 629 error = copyout(&fl, flp, sizeof fl); 630 if (error) 631 return error; 632 633 error = fcntl(td, &fa); 634 if (error || SCARG(&fa, cmd) != F_GETLK) 635 return error; 636 637 error = copyin(flp, &fl, sizeof fl); 638 if (error) 639 return error; 640 641 bsd_to_svr4_flock(&fl, &ifl); 642 643 return copyout(&ifl, SCARG(uap, arg), sizeof ifl); 644 } 645 case -1: 646 switch (SCARG(uap, cmd)) { 647 case SVR4_F_DUP2FD: 648 { 649 struct dup2_args du; 650 651 SCARG(&du, from) = SCARG(uap, fd); 652 SCARG(&du, to) = (int)SCARG(uap, arg); 653 error = dup2(td, &du); 654 if (error) 655 return error; 656 *retval = SCARG(&du, to); 657 return 0; 658 } 659 660 case SVR4_F_FREESP: 661 { 662 struct svr4_flock ifl; 663 struct flock fl; 664 665 error = copyin(SCARG(uap, arg), &ifl, 666 sizeof ifl); 667 if (error) 668 return error; 669 svr4_to_bsd_flock(&ifl, &fl); 670 return fd_truncate(td, SCARG(uap, fd), &fl); 671 } 672 673 case SVR4_F_GETLK64: 674 case SVR4_F_SETLK64: 675 case SVR4_F_SETLKW64: 676 { 677 struct svr4_flock64 ifl; 678 struct flock *flp, fl; 679 caddr_t sg = stackgap_init(); 680 681 flp = stackgap_alloc(&sg, sizeof(struct flock)); 682 SCARG(&fa, arg) = (long) flp; 683 684 error = copyin(SCARG(uap, arg), &ifl, 685 sizeof ifl); 686 if (error) 687 return error; 688 689 svr4_to_bsd_flock64(&ifl, &fl); 690 691 error = copyout(&fl, flp, sizeof fl); 692 if (error) 693 return error; 694 695 error = fcntl(td, &fa); 696 if (error || SCARG(&fa, cmd) != F_GETLK) 697 return error; 698 699 error = copyin(flp, &fl, sizeof fl); 700 if (error) 701 return error; 702 703 bsd_to_svr4_flock64(&fl, &ifl); 704 705 return copyout(&ifl, SCARG(uap, arg), 706 sizeof ifl); 707 } 708 709 case SVR4_F_FREESP64: 710 { 711 struct svr4_flock64 ifl; 712 struct flock fl; 713 714 error = copyin(SCARG(uap, arg), &ifl, 715 sizeof ifl); 716 if (error) 717 return error; 718 svr4_to_bsd_flock64(&ifl, &fl); 719 return fd_truncate(td, SCARG(uap, fd), &fl); 720 } 721 722 case SVR4_F_REVOKE: 723 return fd_revoke(td, SCARG(uap, fd)); 724 725 default: 726 return ENOSYS; 727 } 728 729 default: 730 return ENOSYS; 731 } 732} 733