source: rtems/c/src/lib/libc/mknod.c @ ddaa60f

4.104.114.84.95
Last change on this file since ddaa60f was ec2328ee, checked in by Jennifer Averett <Jennifer.Averett@…>, on 03/31/99 at 23:24:57

Removed asserts that shouldn't be called and commented case where this
indicates an internal error.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  mknod()
3 *
4 *  This routine is not defined in the POSIX 1003.1b standard but is
5 *  commonly supported on most UNIX and POSIX systems.  It is the
6 *  foundation for creating file system objects. 
7 *
8 *  COPYRIGHT (c) 1989-1998.
9 *  On-Line Applications Research Corporation (OAR).
10 *  Copyright assigned to U.S. Government, 1994.
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.OARcorp.com/rtems/license.html.
15 *
16 *  $Id$
17 */
18
19#include <sys/types.h>
20#include <sys/stat.h>
21#include <fcntl.h>
22#include <unistd.h>
23#include <errno.h>
24#include <stdlib.h>
25
26#include "libio_.h"
27
28int mknod(
29  const char *pathname,
30  mode_t      mode,
31  dev_t       dev
32)
33{
34  rtems_filesystem_location_info_t    temp_loc;
35  int                                 i;
36  const char                         *name_start;
37  int                                 result;
38
39  if ( !(mode & (S_IFREG|S_IFCHR|S_IFBLK|S_IFIFO) ) )
40    set_errno_and_return_minus_one( EINVAL );
41 
42  if ( S_ISFIFO(mode) )
43    set_errno_and_return_minus_one( ENOTSUP );
44
45  rtems_filesystem_get_start_loc( pathname, &i, &temp_loc );
46
47  result = (*temp_loc.ops->evalformake)(
48    &pathname[i],
49    &temp_loc,
50    &name_start
51  );
52  if ( result != 0 )
53    return -1;
54
55  if ( !temp_loc.ops->mknod )
56    set_errno_and_return_minus_one( ENOTSUP );
57
58  return (*temp_loc.ops->mknod)( name_start, mode, dev, &temp_loc );
59}
Note: See TracBrowser for help on using the repository browser.