Print this page
3910 t_look(3NSL) should never return T_ERROR


   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*

  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  27 /*        All Rights Reserved   */
  28 
  29 /*
  30  * University Copyright- Copyright (c) 1982, 1986, 1988
  31  * The Regents of the University of California
  32  * All Rights Reserved
  33  *
  34  * University Acknowledgment- Portions of this document are derived from
  35  * software developed by the University of California, Berkeley, and its
  36  * contributors.
  37  */
  38 
  39 #pragma ident   "%Z%%M% %I%     %E% SMI"
  40 
  41 /*
  42  * Kernel TLI-like function to read a datagram off of a
  43  * transport endpoints stream head.
  44  *
  45  * Returns:
  46  *      0       On success or positive error code.
  47  *              On sucess, type is set to:
  48  *      T_DATA          If normal data has been received
  49  *      T_UDERR         If an error indication has been received,
  50  *                      in which case uderr contains the unitdata
  51  *                      error number.
  52  *      T_ERROR
  53  */
  54 
  55 #include <sys/param.h>
  56 #include <sys/types.h>
  57 #include <sys/user.h>
  58 #include <sys/file.h>
  59 #include <sys/errno.h>
  60 #include <sys/stream.h>
  61 #include <sys/strsubr.h>
  62 #include <sys/vnode.h>
  63 #include <sys/ioctl.h>
  64 #include <sys/stropts.h>
  65 #include <sys/tihdr.h>
  66 #include <sys/timod.h>
  67 #include <sys/tiuser.h>
  68 #include <sys/t_kuser.h>
  69 #include <sys/sysmacros.h>
  70 #include <sys/strsun.h>
  71 
  72 


 277                         unitdata->udata.len = 0;
 278 
 279                         freemsg(bp);
 280 
 281                         *type = T_UDERR;
 282                         break;
 283 
 284                 default:
 285                         KTLILOG(1,
 286                             "t_krcvudata: Unknown transport primitive %d\n",
 287                             pptr->type);
 288                         error = EPROTO;
 289                         freemsg(bp);
 290                         break;
 291                 }
 292                 break;
 293 
 294         case M_FLUSH:
 295                 KTLILOG(1, "t_krcvudata: tli_recv returned M_FLUSH\n", 0);
 296                 freemsg(bp);
 297                 *type = T_ERROR;
 298                 break;
 299 
 300         default:
 301                 KTLILOG(1, "t_krcvudata: unknown message type %x\n",
 302                     bp->b_datap->db_type);
 303                 freemsg(bp);
 304                 *type = T_ERROR;
 305                 break;
 306         }
 307 
 308         return (error);
 309 }


   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2014 Gary Mills
  23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  28 /*        All Rights Reserved   */
  29 
  30 /*
  31  * University Copyright- Copyright (c) 1982, 1986, 1988
  32  * The Regents of the University of California
  33  * All Rights Reserved
  34  *
  35  * University Acknowledgment- Portions of this document are derived from
  36  * software developed by the University of California, Berkeley, and its
  37  * contributors.
  38  */
  39 


  40 /*
  41  * Kernel TLI-like function to read a datagram off of a
  42  * transport endpoints stream head.
  43  *
  44  * Returns:
  45  *      0       On success or positive error code.
  46  *              On sucess, type is set to:
  47  *      T_DATA          If normal data has been received
  48  *      T_UDERR         If an error indication has been received,
  49  *                      in which case uderr contains the unitdata
  50  *                      error number.

  51  */
  52 
  53 #include <sys/param.h>
  54 #include <sys/types.h>
  55 #include <sys/user.h>
  56 #include <sys/file.h>
  57 #include <sys/errno.h>
  58 #include <sys/stream.h>
  59 #include <sys/strsubr.h>
  60 #include <sys/vnode.h>
  61 #include <sys/ioctl.h>
  62 #include <sys/stropts.h>
  63 #include <sys/tihdr.h>
  64 #include <sys/timod.h>
  65 #include <sys/tiuser.h>
  66 #include <sys/t_kuser.h>
  67 #include <sys/sysmacros.h>
  68 #include <sys/strsun.h>
  69 
  70 


 275                         unitdata->udata.len = 0;
 276 
 277                         freemsg(bp);
 278 
 279                         *type = T_UDERR;
 280                         break;
 281 
 282                 default:
 283                         KTLILOG(1,
 284                             "t_krcvudata: Unknown transport primitive %d\n",
 285                             pptr->type);
 286                         error = EPROTO;
 287                         freemsg(bp);
 288                         break;
 289                 }
 290                 break;
 291 
 292         case M_FLUSH:
 293                 KTLILOG(1, "t_krcvudata: tli_recv returned M_FLUSH\n", 0);
 294                 freemsg(bp);
 295                 error = EBADMSG;
 296                 break;
 297 
 298         default:
 299                 KTLILOG(1, "t_krcvudata: unknown message type %x\n",
 300                     bp->b_datap->db_type);
 301                 freemsg(bp);
 302                 error = EBADMSG;
 303                 break;
 304         }
 305 
 306         return (error);
 307 }