1 /*
2  * Copyright (c) 2013 The Native Client Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6 
7 #include "native_client/src/untrusted/nacl/nacl_irt.h"
8 
__libnacl_irt_dev_fdio_init(void)9 void __libnacl_irt_dev_fdio_init(void) {
10   /* Attempt to load the 'dev-fdio' interface */
11   if (!__libnacl_irt_query(NACL_IRT_DEV_FDIO_v0_3,
12                            &__libnacl_irt_dev_fdio,
13                            sizeof(__libnacl_irt_dev_fdio))) {
14     /*
15      * Fall back to old 'fdio' interface if the dev interface is
16      * not found.
17      */
18     if (!__libnacl_irt_query(NACL_IRT_DEV_FDIO_v0_2,
19                              &__libnacl_irt_dev_fdio,
20                              sizeof(struct nacl_irt_dev_fdio_v0_2))) {
21       __libnacl_irt_query(NACL_IRT_DEV_FDIO_v0_1,
22                           &__libnacl_irt_dev_fdio,
23                           sizeof(struct nacl_irt_fdio));
24     }
25   }
26 }
27