ng_device.c (81755e6eb6bb3fa6f6fe59c45dcbc9bc4e1cc94b) | ng_device.c (47095f775f9b9923350a5ab0796a4e08e2c62151) |
---|---|
1/* 2 * Copyright (c) 2002 Mark Santcroos <marks@ripe.net> 3 * Copyright (c) 2004 Gleb Smirnoff <glebius@FreeBSD.org> 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 --- 419 unchanged lines hidden (view full) --- 428 /* get an mbuf */ 429 do { 430 IF_DEQUEUE(&priv->readq, m); 431 if (m == NULL) { 432 if (flag & IO_NDELAY) 433 return (EWOULDBLOCK); 434 mtx_lock(&priv->ngd_mtx); 435 priv->flags |= NGDF_RWAIT; | 1/* 2 * Copyright (c) 2002 Mark Santcroos <marks@ripe.net> 3 * Copyright (c) 2004 Gleb Smirnoff <glebius@FreeBSD.org> 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 --- 419 unchanged lines hidden (view full) --- 428 /* get an mbuf */ 429 do { 430 IF_DEQUEUE(&priv->readq, m); 431 if (m == NULL) { 432 if (flag & IO_NDELAY) 433 return (EWOULDBLOCK); 434 mtx_lock(&priv->ngd_mtx); 435 priv->flags |= NGDF_RWAIT; |
436 mtx_unlock(&priv->ngd_mtx); 437 if ((error = tsleep(priv, PCATCH | (PZERO + 1), | 436 if ((error = msleep(priv, &priv->ngd_mtx, 437 PDROP | PCATCH | (PZERO + 1), |
438 "ngdread", 0)) != 0) 439 return (error); 440 } 441 } while (m == NULL); 442 443 while (m && uio->uio_resid > 0 && error == 0) { 444 len = MIN(uio->uio_resid, m->m_len); 445 if (len != 0) --- 92 unchanged lines hidden --- | 438 "ngdread", 0)) != 0) 439 return (error); 440 } 441 } while (m == NULL); 442 443 while (m && uio->uio_resid > 0 && error == 0) { 444 len = MIN(uio->uio_resid, m->m_len); 445 if (len != 0) --- 92 unchanged lines hidden --- |