Files
Arquivotheca.SunOS-4.1.4/usr.lib/libsunwindow/notify/ndet_fd.c
seta75D ff309bfe1c Init
2021-10-11 18:37:13 -03:00

35 lines
687 B
C

#ifndef lint
#ifdef sccs
static char sccsid[] = "@(#)ndet_fd.c 1.1 94/10/31 Copyr 1985 Sun Micro";
#endif
#endif
/*
* Copyright (c) 1985 by Sun Microsystems, Inc.
*/
/*
* Ndet_fd.c - Implement file descriptor specific calls that are shared among
* NTFY_INPUT, NTFY_OUTPUT and NTFY_EXCEPTION.
*/
#include <sunwindow/ntfy.h>
#include <sunwindow/ndet.h>
/* performance: global cache of getdtablesize() */
extern int dtablesize_cache;
#define GETDTABLESIZE() \
(dtablesize_cache?dtablesize_cache:(dtablesize_cache=getdtablesize()))
pkg_private int
ndet_check_fd(fd)
int fd;
{
if (fd < 0 || fd >= GETDTABLESIZE()) {
ntfy_set_errno(NOTIFY_BADF);
return(-1);
}
return(0);
}