mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-11-16 12:34:45 +00:00
* src/mqueuesendsupp.c: Account for possibly blocking during the core send operation. 2001-08-16 Joel Sherrill <joel@OARcorp.com> * src/msgqsubmit.c: Add a comment indicating that we do not have to account for possibly blocking during the core send operation because Classic API message queue send is always non-blocking. 2001-08-16 Joel Sherrill <joel@OARcorp.com> * include/rtems/score/coremsg.h, src/coremsgsubmit.c: Add a new return status to account for blocking sends. Otherwise, the caller will think that the returned message status will have the ultimate results of the operation. If the send times out, the final status will be in the return_code of the thread. 2001-08-16 Joel Sherrill <joel@OARcorp.com> * src/coremutexsurrender.c: Use holder thread not executing thread because even though they may and often are the same it is not guaranteed unless the proper attribute is set. 2001-08-16 Joel Sherrill <joel@OARcorp.com> * startup/linkcmds: Modified to work better with gcc 2.8.1 and gnat 3.13p. 2001-08-16 Joel Sherrill <joel@OARcorp.com> * tools/runtest.in: Recognize debug variant of monitor test. 2001-08-16 Joel Sherrill <joel@OARcorp.com> * sp13/sp13.scn: Id in screen had wrong class field value. * sp13/system.h: Account for message buffer memory. * sp13/task2.c: Remove unnecessary check for failure. 2001-08-16 Joel Sherrill <joel@OARcorp.com> * sp20/system.h: Account for extra task stacks properly. 2001-08-16 Joel Sherrill <joel@OARcorp.com> * include/tmacros.h: Attempt to print errno as further information.
71 lines
1.4 KiB
C
71 lines
1.4 KiB
C
/*
|
|
* This file contains the support infrastructure used to manage the
|
|
* table of integer style file descriptors used by the socket calls.
|
|
*
|
|
* COPYRIGHT (c) 1989-1999.
|
|
* On-Line Applications Research Corporation (OAR).
|
|
*
|
|
* The license and distribution terms for this file may be
|
|
* found in the file LICENSE in this distribution or at
|
|
* http://www.OARcorp.com/rtems/license.html.
|
|
*
|
|
* $Id$
|
|
*/
|
|
|
|
#include "libio_.h" /* libio_.h pulls in rtems */
|
|
#include <rtems.h>
|
|
|
|
#include <errno.h>
|
|
|
|
/*
|
|
* Convert an RTEMS file descriptor to a BSD socket pointer.
|
|
*/
|
|
|
|
struct socket *rtems_bsdnet_fdToSocket(
|
|
int fd
|
|
)
|
|
{
|
|
rtems_libio_t *iop;
|
|
|
|
if ((unsigned32)fd >= rtems_libio_number_iops) {
|
|
errno = EBADF;
|
|
return NULL;
|
|
}
|
|
iop = &rtems_libio_iops[fd];
|
|
|
|
/* same as rtems_libio_check_is_open(iop) but different return */
|
|
if ((iop->flags & LIBIO_FLAGS_OPEN) == 0) {
|
|
errno = EBADF;
|
|
return NULL;
|
|
}
|
|
|
|
if (iop->data1 == NULL)
|
|
errno = EBADF;
|
|
return iop->data1;
|
|
}
|
|
|
|
/*
|
|
* Create an RTEMS file descriptor for a socket
|
|
*/
|
|
|
|
int rtems_bsdnet_makeFdForSocket(
|
|
void *so,
|
|
const rtems_filesystem_file_handlers_r *h
|
|
)
|
|
{
|
|
rtems_libio_t *iop;
|
|
int fd;
|
|
|
|
iop = rtems_libio_allocate();
|
|
if (iop == 0) {
|
|
errno = ENFILE;
|
|
return -1;
|
|
}
|
|
fd = iop - rtems_libio_iops;
|
|
iop->flags |= LIBIO_FLAGS_WRITE | LIBIO_FLAGS_READ;
|
|
iop->data0 = fd;
|
|
iop->data1 = so;
|
|
iop->handlers = (rtems_filesystem_file_handlers_r *) h;
|
|
return fd;
|
|
}
|