#include <stdio.h>#include <slang.h>#include <unistd.h>#include <string.h>#include <fcntl.h>#include <errno.h>Go to the source code of this file.
Defines | |
| #define | F SLANG_FILE_FD_TYPE |
| #define | I SLANG_INT_TYPE |
Functions | |
| SLANG_MODULE (fcntl) | |
| static int | check_and_set_errno (int e) |
| static int | do_fcntl_2 (SLFile_FD_Type *f, int cmd) |
| static int | do_fcntl_3_int (SLFile_FD_Type *f, int cmd, int flags) |
| static int | fcntl_getfd (SLFile_FD_Type *f) |
| static int | fcntl_setfd (SLFile_FD_Type *f, int *flags) |
| static int | fcntl_getfl (SLFile_FD_Type *f) |
| static int | fcntl_setfl (SLFile_FD_Type *f, int *flags) |
| int | init_fcntl_module_ns (char *ns_name) |
| void | deinit_fcntl_module (void) |
Variables | |
| static SLang_Intrin_Fun_Type | Fcntl_Intrinsics [] |
| static SLang_IConstant_Type | Fcntl_Consts [] |
|
|
Definition at line 79 of file fcntl-module.c. |
|
|
Definition at line 80 of file fcntl-module.c. |
|
|
Definition at line 18 of file fcntl-module.c. References EINTR, and SLerrno_set_errno(). Referenced by do_fcntl_2(), do_fcntl_3_int(), do_syscall_0(), do_syscall_1(), do_syscall_struct_1(), and do_syscall_struct_2(). 00019 { 00020 #ifdef EINTR 00021 if (e == EINTR) 00022 return 0; 00023 #endif 00024 (void) SLerrno_set_errno (e); 00025 return -1; 00026 }
|
|
|
Definition at line 115 of file fcntl-module.c.
|
|
||||||||||||
|
Definition at line 28 of file fcntl-module.c. References check_and_set_errno(), and SLfile_get_fd(). Referenced by fcntl_getfd(), and fcntl_getfl(). 00029 { 00030 int ret; 00031 int fd; 00032 00033 if (-1 == SLfile_get_fd (f, &fd)) 00034 return -1; 00035 00036 while ((-1 == (ret = fcntl (fd, cmd))) 00037 && (0 == check_and_set_errno (errno))) 00038 ; 00039 00040 return ret; 00041 }
|
|
||||||||||||||||
|
Definition at line 43 of file fcntl-module.c. References check_and_set_errno(), and SLfile_get_fd(). Referenced by fcntl_setfd(), and fcntl_setfl(). 00044 { 00045 int ret; 00046 int fd; 00047 00048 00049 if (-1 == SLfile_get_fd (f, &fd)) 00050 return -1; 00051 00052 while ((-1 == (ret = fcntl (fd, cmd, flags))) 00053 && (0 == check_and_set_errno (errno))) 00054 ; 00055 00056 return ret; 00057 }
|
|
|
Definition at line 59 of file fcntl-module.c. References do_fcntl_2(). 00060 { 00061 return do_fcntl_2 (f, F_GETFD); 00062 }
|
|
|
Definition at line 69 of file fcntl-module.c. References do_fcntl_2(). 00070 { 00071 return do_fcntl_2 (f, F_GETFL); 00072 }
|
|
||||||||||||
|
Definition at line 64 of file fcntl-module.c. References do_fcntl_3_int(). 00065 { 00066 return do_fcntl_3_int (f, F_SETFD, *flags); 00067 }
|
|
||||||||||||
|
Definition at line 74 of file fcntl-module.c. References do_fcntl_3_int(). 00075 { 00076 return do_fcntl_3_int (f, F_SETFL, *flags); 00077 }
|
|
|
Definition at line 99 of file fcntl-module.c. References SLns_add_iconstant_table(), SLns_add_intrin_fun_table(), and SLns_create_namespace(). 00100 { 00101 SLang_NameSpace_Type *ns; 00102 00103 ns = SLns_create_namespace (ns_name); 00104 if (ns == NULL) 00105 return -1; 00106 00107 if ((-1 == SLns_add_intrin_fun_table (ns, Fcntl_Intrinsics, "__FCNTL__")) 00108 || (-1 == SLns_add_iconstant_table (ns, Fcntl_Consts, NULL))) 00109 return -1; 00110 00111 return 0; 00112 }
|
|
|
|
|
|
Initial value:
{
MAKE_ICONSTANT("FD_CLOEXEC", FD_CLOEXEC),
SLANG_END_ICONST_TABLE
}
Definition at line 93 of file fcntl-module.c. |
|
|
Initial value:
{
MAKE_INTRINSIC_1("fcntl_getfd", fcntl_getfd, I, F),
MAKE_INTRINSIC_2("fcntl_setfd", fcntl_setfd, I, F, I),
MAKE_INTRINSIC_1("fcntl_getfl", fcntl_getfl, I, F),
MAKE_INTRINSIC_2("fcntl_setfl", fcntl_setfl, I, F, I),
SLANG_END_INTRIN_FUN_TABLE
}
Definition at line 81 of file fcntl-module.c. |