/* create a winstation object */ static struct winstation *create_winstation( struct directory *root, const struct unicode_str *name, unsigned int attr, unsigned int flags ) { struct winstation *winstation; if (memchrW( name->str, '\\', name->len / sizeof(WCHAR) )) /* no backslash allowed in name */ { set_error( STATUS_INVALID_PARAMETER ); return NULL; } if ((winstation = create_named_object_dir( root, name, attr, &winstation_ops ))) { if (get_error() != STATUS_OBJECT_NAME_EXISTS) { /* initialize it if it didn't already exist */ winstation->flags = flags; winstation->clipboard = NULL; winstation->atom_table = NULL; list_add_tail( &winstation_list, &winstation->entry ); list_init( &winstation->desktops ); if (!(winstation->desktop_names = create_namespace( 7 ))) { release_object( winstation ); return NULL; } } } return winstation; }
int main() { int ret=-1; namespace *ns = NULL; char name[10],desc[20],hash[10],store[10],scheme[10],path[50]; int size; printf("name,desc,md5,default,variable,0,store path\n"); ret = create_namespace("ns4","Namespace ns3","md5","object","/home/kus/storepath4","fixed",1024); printf("%d\n",ret); return ret; }
rtobject_t* rtobject_alloca(){ rtobject_t* new_obj; new_obj = (rtobject_t*)malloc(sizeof(rtobject_t)); if (!new_obj) return new_obj; new_obj->name=0; new_obj->description=0; new_obj->address=-1; new_obj->parent=0; new_obj->process_index=-1; new_obj->major_type=-1; new_obj->imp_type=-1; new_obj->imp_subtype=-1; new_obj->imp_struct=0; /*control list*/ new_obj->control_list=0; if (!(new_obj->control_ns = create_namespace(&new_obj->control_list, control_name_lookup))){ printf("memory error\n"); return 0; } /*data port list*/ new_obj->data_port_list_size=0; new_obj->data_port_list=0; if (!(new_obj->data_port_ns = create_namespace(&new_obj->data_port_list, data_port_name_lookup))){ printf("memory error\n"); return 0; } new_obj->instance_list_size=0; new_obj->instance_list=0; new_obj->outdated_instance_list=0; new_obj->event_map_list=0; return new_obj; }
android_namespace_t* android_create_namespace(const char* name, const char* ld_library_path, const char* default_library_path, uint64_t type, const char* permitted_when_isolated_path, android_namespace_t* parent_namespace) { void* caller_addr = __builtin_return_address(0); ScopedPthreadMutexLocker locker(&g_dl_mutex); android_namespace_t* result = create_namespace(caller_addr, name, ld_library_path, default_library_path, type, permitted_when_isolated_path, parent_namespace); if (result == nullptr) { __bionic_format_dlerror("android_create_namespace failed", linker_get_error_buffer()); } return result; }