~clint-fewbar/ubuntu/precise/erlang/merge-15b

« back to all changes in this revision

Viewing changes to erts/emulator/beam/erl_bif_ddll.c

  • Committer: Package Import Robot
  • Author(s): Sergei Golovan
  • Date: 2011-12-15 19:20:10 UTC
  • mfrom: (1.1.18) (3.5.15 sid)
  • mto: (3.5.16 sid)
  • mto: This revision was merged to the branch mainline in revision 33.
  • Revision ID: package-import@ubuntu.com-20111215192010-jnxcfe3tbrpp0big
Tags: 1:15.b-dfsg-1
* New upstream release.
* Upload to experimental because this release breaks external drivers
  API along with ABI, so several applications are to be fixed.
* Removed SSL patch because the old SSL implementation is removed from
  the upstream distribution.
* Removed never used patch which added native code to erlang beam files.
* Removed the erlang-docbuilder binary package because the docbuilder
  application was dropped by upstream.
* Documented dropping ${erlang-docbuilder:Depends} substvar in
  erlang-depends(1) manpage.
* Made erlang-base and erlang-base-hipe provide virtual package
  erlang-abi-15.b (the number means the first erlang version, which
  provides current ABI).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * %CopyrightBegin%
3
3
 * 
4
 
 * Copyright Ericsson AB 2006-2010. All Rights Reserved.
 
4
 * Copyright Ericsson AB 2006-2011. All Rights Reserved.
5
5
 * 
6
6
 * The contents of this file are subject to the Erlang Public License,
7
7
 * Version 1.1, (the "License"); you may not use this file except in
142
142
 * really load and add as LOADED {ok,loaded} {ok,pending_driver}
143
143
 * {error, permanent} {error,load_error()}
144
144
 */
145
 
BIF_RETTYPE erl_ddll_try_load_3(Process *p, Eterm path_term, 
146
 
                                Eterm name_term, Eterm options)
 
145
BIF_RETTYPE erl_ddll_try_load_3(BIF_ALIST_3)
147
146
{
 
147
    Eterm path_term = BIF_ARG_1;
 
148
    Eterm name_term = BIF_ARG_2;
 
149
    Eterm options = BIF_ARG_3;
148
150
    char *path = NULL;
149
 
    int path_len;
 
151
    Uint path_len;
150
152
    char *name = NULL;
151
153
    DE_Handle *dh;
152
154
    erts_driver_t *drv;
221
223
        goto error;
222
224
    }
223
225
 
224
 
    path_len = io_list_len(path_term);
225
 
 
226
 
    if (path_len <= 0) {
 
226
    if (erts_iolist_size(path_term, &path_len)) {
227
227
        goto error;
228
228
    }
229
229
    path = erts_alloc(ERTS_ALC_T_DDLL_TMP_BUF, path_len + 1 /* might need path separator */ + sys_strlen(name) + 1);
238
238
    sys_strcpy(path+path_len,name);
239
239
 
240
240
#if DDLL_SMP
241
 
    erts_smp_proc_unlock(p, ERTS_PROC_LOCK_MAIN);
 
241
    erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN);
242
242
    lock_drv_list();
243
243
#endif
244
244
    if ((drv = lookup_driver(name)) != NULL) {
249
249
        } else {
250
250
            dh = drv->handle;
251
251
            if (dh->status == ERL_DE_OK) {
252
 
                int is_last = is_last_user(dh,p);
 
252
                int is_last = is_last_user(dh, BIF_P);
253
253
                if (reload == 1 && !is_last) {
254
254
                    /*Want reload if no other users, 
255
255
                      but there are others...*/
263
263
                        soft_error_term = am_inconsistent;
264
264
                        goto soft_error;
265
265
                    }
266
 
                    if ((old = find_proc_entry(dh, p, ERL_DE_PROC_LOADED)) == 
 
266
                    if ((old = find_proc_entry(dh, BIF_P,
 
267
                                               ERL_DE_PROC_LOADED)) ==
267
268
                        NULL) {
268
269
                        soft_error_term = am_not_loaded_by_this_process;
269
270
                        goto soft_error;
274
275
                    }
275
276
                    /* Reload requested and granted */
276
277
                    dereference_all_processes(dh);
277
 
                    set_driver_reloading(dh, p, path, name, flags);
 
278
                    set_driver_reloading(dh, BIF_P, path, name, flags);
278
279
                    if (dh->flags & ERL_DE_FL_KILL_PORTS) {
279
280
                        kill_ports = 1;
280
281
                    }
288
289
                        soft_error_term = am_inconsistent;
289
290
                        goto soft_error;
290
291
                    }
291
 
                    add_proc_loaded(dh,p);
 
292
                    add_proc_loaded(dh, BIF_P);
292
293
                    erts_ddll_reference_driver(dh);
293
294
                    monitor = 0;
294
295
                    ok_term = mkatom("already_loaded");
310
311
                notify_all(dh, drv->name, 
311
312
                           ERL_DE_PROC_AWAIT_UNLOAD, am_UP, 
312
313
                           am_unload_cancelled);
313
 
                add_proc_loaded(dh,p);
 
314
                add_proc_loaded(dh, BIF_P);
314
315
                erts_ddll_reference_driver(dh);
315
316
                monitor = 0;
316
317
                ok_term = mkatom("already_loaded");
327
328
                    goto soft_error;
328
329
                }
329
330
                /* Load of granted unload... */
330
 
                add_proc_loaded_deref(dh,p); /* Dont reference, will happen after reload */
 
331
                /* Don't reference, will happen after reload */
 
332
                add_proc_loaded_deref(dh, BIF_P);
331
333
                ++monitor;
332
334
                ok_term = am_pending_driver;
333
335
            } else { /* ERL_DE_PERMANENT */
347
349
            goto soft_error;
348
350
        } else {
349
351
            dh->flags = flags;
350
 
            add_proc_loaded(dh,p);
 
352
            add_proc_loaded(dh, BIF_P);
351
353
            first_ddll_reference(dh);
352
354
            monitor = 0;
353
355
            ok_term = mkatom("loaded");
371
373
            if (!(prt->status & FREE_PORT_FLAGS) &&
372
374
                prt->drv_ptr->handle == dh) {
373
375
#if DDLL_SMP
374
 
                erts_smp_atomic_inc(&prt->refc);
 
376
                erts_smp_atomic_inc_nob(&prt->refc);
375
377
                /* Extremely rare spinlock */
376
378
                while(prt->status & ERTS_PORT_SFLG_INITIALIZING) {
377
379
                       erts_smp_port_state_unlock(prt);
399
401
#if DDLL_SMP
400
402
    erts_ddll_reference_driver(dh);
401
403
    unlock_drv_list();
402
 
    erts_smp_proc_lock(p, ERTS_PROC_LOCK_MAIN);
 
404
    erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN);
403
405
    lock_drv_list();
404
406
    erts_ddll_dereference_driver(dh);
405
407
#endif
406
408
 
407
 
    p->flags |= F_USING_DDLL;
 
409
    BIF_P->flags |= F_USING_DDLL;
408
410
    if (monitor) {
409
 
        Eterm mref = add_monitor(p, dh, ERL_DE_PROC_AWAIT_LOAD);
410
 
        hp = HAlloc(p,4);
 
411
        Eterm mref = add_monitor(BIF_P, dh, ERL_DE_PROC_AWAIT_LOAD);
 
412
        hp = HAlloc(BIF_P, 4);
411
413
        t = TUPLE3(hp, am_ok, ok_term, mref);
412
414
    } else {
413
 
        hp = HAlloc(p,3);
 
415
        hp = HAlloc(BIF_P, 3);
414
416
        t = TUPLE2(hp, am_ok, ok_term);
415
417
    }
416
418
#if DDLL_SMP
418
420
#endif
419
421
    erts_free(ERTS_ALC_T_DDLL_TMP_BUF, (void *) path);
420
422
    erts_free(ERTS_ALC_T_DDLL_TMP_BUF, (void *) name);
421
 
    ERTS_SMP_LC_ASSERT(ERTS_PROC_LOCK_MAIN & erts_proc_lc_my_proc_locks(p));
 
423
    ERTS_SMP_LC_ASSERT(ERTS_PROC_LOCK_MAIN & erts_proc_lc_my_proc_locks(BIF_P));
422
424
    BIF_RET(t);
423
425
 soft_error:
424
426
#if DDLL_SMP
425
427
    unlock_drv_list();
426
 
    erts_smp_proc_lock(p, ERTS_PROC_LOCK_MAIN);
 
428
    erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN);
427
429
#endif
428
430
    if (do_build_load_error) {
429
 
        soft_error_term = build_load_error(p, build_this_load_error);
 
431
        soft_error_term = build_load_error(BIF_P, build_this_load_error);
430
432
    }
431
433
 
432
 
    hp = HAlloc(p,3);
 
434
    hp = HAlloc(BIF_P, 3);
433
435
    t = TUPLE2(hp, am_error, soft_error_term);
434
436
    erts_free(ERTS_ALC_T_DDLL_TMP_BUF, (void *) path);
435
437
    erts_free(ERTS_ALC_T_DDLL_TMP_BUF, (void *) name);
436
 
    ERTS_SMP_LC_ASSERT(ERTS_PROC_LOCK_MAIN & erts_proc_lc_my_proc_locks(p));
 
438
    ERTS_SMP_LC_ASSERT(ERTS_PROC_LOCK_MAIN & erts_proc_lc_my_proc_locks(BIF_P));
437
439
    BIF_RET(t);
438
440
 error:
439
441
    assert_drv_list_not_locked();
440
 
    ERTS_SMP_LC_ASSERT(ERTS_PROC_LOCK_MAIN & erts_proc_lc_my_proc_locks(p));
 
442
    ERTS_SMP_LC_ASSERT(ERTS_PROC_LOCK_MAIN & erts_proc_lc_my_proc_locks(BIF_P));
441
443
    if (path != NULL) {
442
444
        erts_free(ERTS_ALC_T_DDLL_TMP_BUF, (void *) path);
443
445
    }
444
446
    if (name != NULL) {
445
447
        erts_free(ERTS_ALC_T_DDLL_TMP_BUF, (void *) name);
446
448
    }
447
 
    BIF_ERROR(p,BADARG);
 
449
    BIF_ERROR(BIF_P, BADARG);
448
450
}
449
451
 
450
452
/*
483
485
   any AWAIT_LOAD-waiters with {'DOWN', ref(), driver, name(), load_cancelled}
484
486
   If the driver made itself permanent, {'UP', ref(), driver, name(), permanent}
485
487
*/
486
 
Eterm erl_ddll_try_unload_2(Process *p, Eterm name_term, Eterm options)
 
488
Eterm erl_ddll_try_unload_2(BIF_ALIST_2)
487
489
{
 
490
    Eterm name_term = BIF_ARG_1;
 
491
    Eterm options = BIF_ARG_2;
488
492
    char *name = NULL;
489
493
    Eterm ok_term = NIL;
490
494
    Eterm soft_error_term = NIL;
497
501
    Eterm l;
498
502
    int kill_ports = 0;
499
503
 
500
 
    erts_smp_proc_unlock(p, ERTS_PROC_LOCK_MAIN);
 
504
    erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN);
501
505
 
502
506
    for(l = options; is_list(l); l =  CDR(list_val(l))) {
503
507
        Eterm opt = CAR(list_val(l));
550
554
    if (dh->flags & ERL_DE_FL_KILL_PORTS) {
551
555
        kill_ports = 1;
552
556
    }
553
 
    if ((pe = find_proc_entry(dh, p, ERL_DE_PROC_LOADED)) == NULL) {
 
557
    if ((pe = find_proc_entry(dh, BIF_P, ERL_DE_PROC_LOADED)) == NULL) {
554
558
        if (num_procs(dh, ERL_DE_PROC_LOADED) > 0) {
555
559
            soft_error_term = am_not_loaded_by_this_process;
556
560
            goto soft_error;
599
603
            if (!(prt->status &  FREE_PORT_FLAGS) 
600
604
                && prt->drv_ptr->handle == dh) {
601
605
#if DDLL_SMP
602
 
                erts_smp_atomic_inc(&prt->refc);
 
606
                erts_smp_atomic_inc_nob(&prt->refc);
603
607
                /* Extremely rare spinlock */
604
608
                while(prt->status & ERTS_PORT_SFLG_INITIALIZING) {
605
609
                       erts_smp_port_state_unlock(prt);
626
630
#if DDLL_SMP
627
631
    erts_ddll_reference_driver(dh);
628
632
    unlock_drv_list();
629
 
    erts_smp_proc_lock(p, ERTS_PROC_LOCK_MAIN);
 
633
    erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN);
630
634
    lock_drv_list();
631
635
    erts_ddll_dereference_driver(dh);
632
636
#endif
633
637
    erts_free(ERTS_ALC_T_DDLL_TMP_BUF, (void *) name);
634
 
    p->flags |= F_USING_DDLL;
 
638
    BIF_P->flags |= F_USING_DDLL;
635
639
    if (monitor > 0) {
636
 
        Eterm mref = add_monitor(p, dh, ERL_DE_PROC_AWAIT_UNLOAD);
637
 
        hp = HAlloc(p,4);
 
640
        Eterm mref = add_monitor(BIF_P, dh, ERL_DE_PROC_AWAIT_UNLOAD);
 
641
        hp = HAlloc(BIF_P, 4);
638
642
        t = TUPLE3(hp, am_ok, ok_term, mref);
639
643
    } else {
640
 
        hp = HAlloc(p,3);
 
644
        hp = HAlloc(BIF_P, 3);
641
645
        t = TUPLE2(hp, am_ok, ok_term);
642
646
    }
643
647
    if (kill_ports > 1) {
644
 
        ERTS_BIF_CHK_EXITED(p); /* May be exited by port killing */
 
648
        ERTS_BIF_CHK_EXITED(BIF_P); /* May be exited by port killing */
645
649
    }
646
650
#if DDLL_SMP
647
651
    unlock_drv_list();
653
657
    unlock_drv_list();
654
658
#endif
655
659
    erts_free(ERTS_ALC_T_DDLL_TMP_BUF, (void *) name);
656
 
    erts_smp_proc_lock(p, ERTS_PROC_LOCK_MAIN);
657
 
    hp = HAlloc(p,3);
 
660
    erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN);
 
661
    hp = HAlloc(BIF_P, 3);
658
662
    t = TUPLE2(hp, am_error, soft_error_term);
659
663
    BIF_RET(t);
660
664
 
663
667
    if (name != NULL) {
664
668
        erts_free(ERTS_ALC_T_DDLL_TMP_BUF, (void *) name);
665
669
    }
666
 
    erts_smp_proc_lock(p, ERTS_PROC_LOCK_MAIN);
667
 
    BIF_ERROR(p,BADARG);
 
670
    erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN);
 
671
    BIF_ERROR(BIF_P, BADARG);
668
672
}
669
673
 
670
674
 
671
675
/* 
672
676
 * A shadow of the "real" demonitor BIF
673
677
 */
674
 
BIF_RETTYPE erl_ddll_demonitor_1(Process *p, Eterm ref)
 
678
BIF_RETTYPE erl_ddll_demonitor_1(BIF_ALIST_1)
675
679
{
676
 
   if (is_not_internal_ref(ref)) {
677
 
       BIF_ERROR(p, BADARG);
 
680
   if (is_not_internal_ref(BIF_ARG_1)) {
 
681
       BIF_ERROR(BIF_P, BADARG);
678
682
   }
679
 
   if (p->flags & F_USING_DDLL) {
680
 
       erts_ddll_remove_monitor(p, ref, ERTS_PROC_LOCK_MAIN);
 
683
   if (BIF_P->flags & F_USING_DDLL) {
 
684
       erts_ddll_remove_monitor(BIF_P, BIF_ARG_1, ERTS_PROC_LOCK_MAIN);
681
685
   }
682
686
   BIF_RET(am_true);
683
687
}
685
689
/* 
686
690
 * A shadow of the "real" monitor BIF
687
691
 */
688
 
BIF_RETTYPE erl_ddll_monitor_2(Process *p, Eterm dr, Eterm what)
 
692
BIF_RETTYPE erl_ddll_monitor_2(BIF_ALIST_2)
689
693
{
690
 
    if (dr != am_driver) {
691
 
        BIF_ERROR(p,BADARG);
 
694
    if (BIF_ARG_1 != am_driver) {
 
695
        BIF_ERROR(BIF_P, BADARG);
692
696
    }
693
 
    return erts_ddll_monitor_driver(p, what, ERTS_PROC_LOCK_MAIN);
 
697
    return erts_ddll_monitor_driver(BIF_P, BIF_ARG_2, ERTS_PROC_LOCK_MAIN);
694
698
}
695
699
 
696
700
/* 
697
701
 * Return list of loaded drivers {ok,[string()]} 
698
702
 */
699
 
Eterm erl_ddll_loaded_drivers_0(Process *p)
 
703
BIF_RETTYPE erl_ddll_loaded_drivers_0(BIF_ALIST_0)
700
704
{
701
705
    Eterm *hp;
702
706
    int need = 3;
708
712
    for (drv = driver_list; drv; drv = drv->next) {
709
713
        need += sys_strlen(drv->name)*2+2;
710
714
    }
711
 
    hp = HAlloc(p,need);
 
715
    hp = HAlloc(BIF_P, need);
712
716
    for (drv = driver_list; drv; drv = drv->next) {
713
717
        Eterm l;
714
718
        l = buf_to_intlist(&hp, drv->name, sys_strlen(drv->name), NIL);
728
732
 * item is processes, driver_options, port_count, linked_in_driver, 
729
733
 * permanent, awaiting_load, awaiting_unload 
730
734
 */
731
 
Eterm erl_ddll_info_2(Process *p, Eterm name_term, Eterm item) 
 
735
BIF_RETTYPE erl_ddll_info_2(BIF_ALIST_2)
732
736
{
 
737
    Process *p = BIF_P;
 
738
    Eterm name_term = BIF_ARG_1;
 
739
    Eterm item = BIF_ARG_2;
733
740
    char *name = NULL;
734
741
    Eterm res = NIL;
735
742
    erts_driver_t *drv;
852
859
 * Backend for erl_ddll:format_error, handles all "soft" errors returned by builtins,
853
860
 * possibly by calling the system specific error handler
854
861
 */
855
 
Eterm erl_ddll_format_error_int_1(Process *p, Eterm code_term)
 
862
BIF_RETTYPE erl_ddll_format_error_int_1(BIF_ALIST_1)
856
863
{
 
864
    Process *p = BIF_P;
 
865
    Eterm code_term = BIF_ARG_1;
857
866
    char *errstring = NULL;
858
867
    int errint;
859
868
    int len;
1056
1065
                        if (!(prt->status & FREE_PORT_FLAGS) &&
1057
1066
                            prt->drv_ptr->handle == dh) {
1058
1067
#if DDLL_SMP
1059
 
                            erts_smp_atomic_inc(&prt->refc);
 
1068
                            erts_smp_atomic_inc_nob(&prt->refc);
1060
1069
                            while(prt->status & ERTS_PORT_SFLG_INITIALIZING) {
1061
1070
                                erts_smp_port_state_unlock(prt);
1062
1071
                                erts_smp_port_state_lock(prt);
1193
1202
static void ddll_no_more_references(void *vdh)
1194
1203
{
1195
1204
    DE_Handle *dh = (DE_Handle *) vdh;
1196
 
    int x;
 
1205
    erts_aint_t x;
1197
1206
 
1198
1207
    lock_drv_list();
1199
1208
 
1560
1569
    
1561
1570
    if ((res = erts_sys_ddll_load_driver_init(dh->handle, 
1562
1571
                                              &init_handle)) != ERL_DE_NO_ERROR) {
1563
 
        erts_sys_ddll_close(dh->handle);
1564
 
        return ERL_DE_LOAD_ERROR_NO_INIT;
 
1572
        res = ERL_DE_LOAD_ERROR_NO_INIT;
 
1573
        goto error;
1565
1574
    }
1566
1575
    
1567
1576
    dp = erts_sys_ddll_call_init(init_handle);
1568
1577
    if (dp == NULL) {
1569
 
        erts_sys_ddll_close(dh->handle);
1570
 
        return ERL_DE_LOAD_ERROR_FAILED_INIT;
 
1578
        res = ERL_DE_LOAD_ERROR_FAILED_INIT;
 
1579
        goto error;
1571
1580
    }
1572
1581
 
1573
1582
    switch (dp->extended_marker) {
1574
 
    case 0:
1575
 
        /*
1576
 
         * This may be an old driver that has been recompiled. If so,
1577
 
         * at least the fields that existed in extended driver version
1578
 
         * 1.0 should be zero. If not, a it is a bad driver. We cannot
1579
 
         * be completely certain that this is a valid driver but this is
1580
 
         * the best we can do with old drivers...
1581
 
         */
1582
 
        if (dp->major_version != 0
1583
 
            || dp->minor_version != 0
1584
 
            || dp->driver_flags != 0
1585
 
            || dp->handle2 != NULL
1586
 
            || dp->process_exit != NULL) {
1587
 
            /* Old driver; needs to be recompiled... */
1588
 
            return ERL_DE_LOAD_ERROR_INCORRECT_VERSION;
1589
 
        }
1590
 
        break;
1591
1583
    case ERL_DRV_EXTENDED_MARKER:
1592
1584
        if (ERL_DRV_EXTENDED_MAJOR_VERSION != dp->major_version
1593
1585
            || ERL_DRV_EXTENDED_MINOR_VERSION < dp->minor_version) {
1594
1586
            /* Incompatible driver version */
1595
 
            return ERL_DE_LOAD_ERROR_INCORRECT_VERSION;
 
1587
            res = ERL_DE_LOAD_ERROR_INCORRECT_VERSION;
 
1588
            goto error;
1596
1589
        }
1597
1590
        break;
1598
1591
    default:
1599
1592
        /* Old driver; needs to be recompiled... */
1600
 
        return ERL_DE_LOAD_ERROR_INCORRECT_VERSION;
 
1593
        res = ERL_DE_LOAD_ERROR_INCORRECT_VERSION;
 
1594
        goto error;
1601
1595
    }
1602
1596
 
1603
1597
    if (strcmp(name, dp->driver_name) != 0) {
1604
 
        erts_sys_ddll_close(dh->handle);
1605
 
        return ERL_DE_LOAD_ERROR_BAD_NAME;
 
1598
        res = ERL_DE_LOAD_ERROR_BAD_NAME;
 
1599
        goto error;
1606
1600
    }
1607
 
    erts_smp_atomic_init(&(dh->refc), (long) 0);
 
1601
    erts_smp_atomic_init_nob(&(dh->refc), (erts_aint_t) 0);
1608
1602
    dh->port_count = 0;
1609
1603
    dh->full_path = erts_alloc(ERTS_ALC_T_DDLL_HANDLE, sys_strlen(path) + 1);
1610
1604
    sys_strcpy(dh->full_path, path);
1617
1611
         */
1618
1612
        erts_free(ERTS_ALC_T_DDLL_HANDLE, dh->full_path);
1619
1613
        dh->full_path = NULL;
1620
 
        erts_sys_ddll_close(dh->handle);
1621
 
        return ERL_DE_LOAD_ERROR_FAILED_INIT;
 
1614
        res = ERL_DE_LOAD_ERROR_FAILED_INIT;
 
1615
        goto error;
1622
1616
    }
1623
 
 
1624
1617
    return ERL_DE_NO_ERROR;
 
1618
 
 
1619
error:
 
1620
    erts_sys_ddll_close(dh->handle);
 
1621
    return res;
1625
1622
}
1626
1623
 
1627
1624
static int do_unload_driver_entry(DE_Handle *dh, Eterm *save_name)
1672
1669
    dh->handle = NULL;
1673
1670
    dh->procs = NULL;
1674
1671
    dh->port_count = 0;
1675
 
    erts_refc_init(&(dh->refc), (long) 0);
 
1672
    erts_refc_init(&(dh->refc), (erts_aint_t) 0);
1676
1673
    dh->status = -1;
1677
1674
    dh->reload_full_path = NULL;
1678
1675
    dh->reload_driver_name = NULL;
1878
1875
static char *pick_list_or_atom(Eterm name_term)
1879
1876
1880
1877
    char *name = NULL;
1881
 
    int name_len;
 
1878
    Uint name_len;
1882
1879
    if (is_atom(name_term)) {
1883
1880
        Atom *ap = atom_tab(atom_val(name_term));
1884
1881
        if (ap->len == 0) {
1890
1887
        memcpy(name,ap->name,ap->len);
1891
1888
        name[ap->len] = '\0';
1892
1889
    } else {
1893
 
        name_len = io_list_len(name_term);
1894
 
        if (name_len <= 0) {
 
1890
        if (erts_iolist_size(name_term, &name_len)) {
1895
1891
            goto error;
1896
1892
        }
1897
1893
        name = erts_alloc(ERTS_ALC_T_DDLL_TMP_BUF, name_len + 1);