openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/glib-2.0/1_2.60.3-r0/glib-2.60.3/glib/gstdio.c
int g_open(const gchar* filename, int flags, int mode)
{
#ifdef G_OS_WIN32
    wchar_t* wfilename = g_utf8_to_utf16(filename, -1, NULL, NULL, NULL);
    int retval;
    int save_errno;

    if (wfilename == NULL)
    {
        errno = EINVAL;
        return -1;
    }

    retval = _wopen(wfilename, flags, mode);
    save_errno = errno;

    g_free(wfilename);

    errno = save_errno;
    return retval;
#else
    int fd;
    do
        fd = open(filename, flags, mode);
    while (G_UNLIKELY(fd == -1 && errno == EINTR));
    return fd;
#endif
}
/**
 * g_open:
 * @filename: (type filename): a pathname in the GLib file name encoding
 *     (UTF-8 on Windows)
 * @flags: as in open()
 * @mode: as in open()
 *
 * A wrapper for the POSIX open() function. The open() function is
 * used to convert a pathname into a file descriptor.
 *
 * On POSIX systems file descriptors are implemented by the operating
 * system. On Windows, it's the C library that implements open() and
 * file descriptors. The actual Win32 API for opening files is quite
 * different, see MSDN documentation for CreateFile(). The Win32 API
 * uses file handles, which are more randomish integers, not small
 * integers like file descriptors.
 *
 * Because file descriptors are specific to the C library on Windows,
 * the file descriptor returned by this function makes sense only to
 * functions in the same C library. Thus if the GLib-using code uses a
 * different C library than GLib does, the file descriptor returned by
 * this function cannot be passed to C library functions like write()
 * or read().
 *
 * See your C library manual for more details about open().
 *
 * Returns: a new file descriptor, or -1 if an error occurred.
 *     The return value can be used exactly like the return value
 *     from open().
 *
 * Since: 2.6
 */
@filename: (type filename): a pathname in the GLib file name encoding
(UTF-8 on Windows)
@flags: as in open()
@mode: as in open()

A wrapper for the POSIX open() function. The open() function is
used to convert a pathname into a file descriptor.

On POSIX systems file descriptors are implemented by the operating
system. On Windows, it's the C library that implements open() and
file descriptors. The actual Win32 API for opening files is quite
different, see MSDN documentation for CreateFile(). The Win32 API
uses file handles, which are more randomish integers, not small
integers like file descriptors.

Because file descriptors are specific to the C library on Windows,
the file descriptor returned by this function makes sense only to
functions in the same C library. Thus if the GLib-using code uses a
different C library than GLib does, the file descriptor returned by
this function cannot be passed to C library functions like write()
or read().

See your C library manual for more details about open().

a new file descriptor, or -1 if an error occurred.
The return value can be used exactly like the return value
from open().


@filename : ( type filename ) : a pathname in the GLib file name encoding ( UTF - 8 on Windows ) @flags : as in open () @mode : as in open () A wrapper for the POSIX open () function . The open () function is used to convert a pathname into a file descriptor . On POSIX systems file descriptors are implemented by the operating system . On Windows it ' s the C library that implements open () and file descriptors . The actual Win32 API for opening files is quite different see MSDN documentation for CreateFile () . The Win32 API uses file handles which are more randomish integers not small integers like file descriptors . Because file descriptors are specific to the C library on Windows the file descriptor returned by this function makes sense only to functions in the same C library . Thus if the GLib - using code uses a different C library than GLib does the file descriptor returned by this function cannot be passed to C library functions like write () or read () . See your C library manual for more details about open () . a new file descriptor or - 1 if an error occurred . The return value can be used exactly like the return value from open () .
int g_open(const gchar* filename, int flags, int mode)
{
#ifdef G_OS_WIN32
    wchar_t* wfilename = g_utf8_to_utf16(filename, -1, NULL, NULL, NULL);
    int retval;
    int save_errno;
    if (wfilename == NULL)
    {
        errno = EINVAL;
        return -1;
    }
    retval = _wopen(wfilename, flags, mode);
    save_errno = errno;
    g_free(wfilename);
    errno = save_errno;
    return retval;
#else
    int fd;
    do
        fd = open(filename, flags, mode);
    while (G_UNLIKELY(fd == -1 && errno == EINTR));
    return fd;
#endif
}
int g_open ( const gchar * filename , int flags , int mode ) { #ifdef G_OS_WIN32 wchar_t * wfilename = g_utf8_to_utf16 ( filename , -1 , NULL , NULL , NULL ) ; int retval ; int save_errno ; if ( wfilename == NULL ) { errno = EINVAL ; return -1 ; } retval = _wopen ( wfilename , flags , mode ) ; save_errno = errno ; g_free ( wfilename ) ; errno = save_errno ; return retval ; #else int fd ; do fd = open ( filename , flags , mode ) ; while ( G_UNLIKELY ( fd == -1 && errno == EINTR ) ) ; return fd ; #endif }
g_open:
 @filename: (type filename): a pathname in the GLib file name encoding
     (UTF-8 on Windows)
 @flags: as in open()
 @mode: as in open()
g_open : @filename : ( type filename ) : a pathname in the GLib file name encoding ( UTF - 8 on Windows ) @flags : as in open () @mode : as in open ()