mailing list of musl libc
 help / color / mirror / code / Atom feed
* missing decription struct named FILE
@ 2016-02-25 18:37 Fiodar
  2016-02-25 18:46 ` Rich Felker
  0 siblings, 1 reply; 5+ messages in thread
From: Fiodar @ 2016-02-25 18:37 UTC (permalink / raw)
  To: musl

How use FILE struct? How does it fields serve? Missing comments, google keep silence...
What I know  FILE is typedefed to struct _IO_FILE. 
Also I recognize 3 pointers to function by they name: size_t (*read), size_t (*write), off_t (*seek). Thei points to functions named read, write an seek, isn't in? Can you give description these fields? I am working with musl libc 1.1.14 now


Stryzhniou Fiodar
Стрижнёв Федор

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: missing decription struct named FILE
  2016-02-25 18:37 missing decription struct named FILE Fiodar
@ 2016-02-25 18:46 ` Rich Felker
  2016-02-25 19:36   ` Re[2]: [musl] " Fiodar
  0 siblings, 1 reply; 5+ messages in thread
From: Rich Felker @ 2016-02-25 18:46 UTC (permalink / raw)
  To: musl

On Thu, Feb 25, 2016 at 09:37:41PM +0300, Fiodar wrote:
> How use FILE struct? How does it fields serve? Missing comments, google keep silence...
> What I know  FILE is typedefed to struct _IO_FILE. 
> Also I recognize 3 pointers to function by they name: size_t
> (*read), size_t (*write), off_t (*seek). Thei points to functions
> named read, write an seek, isn't in? Can you give description these
> fields? I am working with musl libc 1.1.14 now

The contents are defined in src/internal/stdio_impl.h, but they are
not a public API and are subject to change. Do you have specific
questions about some of the fields?

Rich


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re[2]: [musl] missing decription struct named FILE
  2016-02-25 18:46 ` Rich Felker
@ 2016-02-25 19:36   ` Fiodar
  2016-02-25 19:52     ` Rich Felker
  0 siblings, 1 reply; 5+ messages in thread
From: Fiodar @ 2016-02-25 19:36 UTC (permalink / raw)
  To: musl

 I always think that FILE is stable public api and may have specific augmentation in various libc implementations/versions.
I use musl libc 1.1.14. I need description all fields and how read, write an seek operates internally with them.
Thanks.


>Чацвер, 25 лютага 2016, 13:46 -05:00 ад Rich Felker <dalias@libc.org>:
>
>On Thu, Feb 25, 2016 at 09:37:41PM +0300, Fiodar wrote:
>> How use FILE struct? How does it fields serve? Missing comments, google keep silence...
>> What I know  FILE is typedefed to struct _IO_FILE. 
>> Also I recognize 3 pointers to function by they name: size_t
>> (*read), size_t (*write), off_t (*seek). Thei points to functions
>> named read, write an seek, isn't in? Can you give description these
>> fields? I am working with musl libc 1.1.14 now
>
>The contents are defined in src/internal/stdio_impl.h, but they are
>not a public API and are subject to change. Do you have specific
>questions about some of the fields?
>
>Rich


Stryzhniou Fiodar
Стрижнёв Федор

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: missing decription struct named FILE
  2016-02-25 19:36   ` Re[2]: [musl] " Fiodar
@ 2016-02-25 19:52     ` Rich Felker
  0 siblings, 0 replies; 5+ messages in thread
From: Rich Felker @ 2016-02-25 19:52 UTC (permalink / raw)
  To: musl

On Thu, Feb 25, 2016 at 10:36:34PM +0300, Fiodar wrote:
> I always think that FILE is stable public api and may have specific

The public interfaces you can pass FILE* to are a stable public API,
but the contents of the pointed-to object, or even whether FILE* is a
real pointer or just some other kind of opaque reference is completely
unspecified and a matter of implementation internals.

> augmentation in various libc implementations/versions.
> I use musl libc 1.1.14. I need description all fields and how read,
> write an seek operates internally with them.

It's not clear what you want to do. If you just want to be able to
operate on the underlying file descriptor, you can use fileno() (a
standard public function) to get the fd number and use any of the
standard functions from unistd.h on it. However mixing use of the
stdio functions and direct operations on the fd will cause problems if
you don't observe some rules for switching between them.

musl also has some lightly abstracted functions for accessing normally
hidden parts of the stdio FILE state which were added (somewhat
reluctantly) to meed the needs of gnulib. They're declared in
stdio_ext.h and defined in src/stdio/ext.c and src/stdio/ext2.c. I
would not recommend using them in new programs (they're mainly for
legacy compatibility with gnulib) but if the alternative is poking at
the FILE structure yourself, they would be a better choice.

Rich


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: missing decription struct named FILE
@ 2016-02-26  4:54 fedor_qd
  0 siblings, 0 replies; 5+ messages in thread
From: fedor_qd @ 2016-02-26  4:54 UTC (permalink / raw)
  To: musl



исходное сбщ
Тема: Re: [musl] missing decription struct named FILE
От: Rich Felker <dalias@libc.org>
Дата: 25.02.2016 22.53

On Thu, Feb 25, 2016 at 10:36:34PM +0300, Fiodar wrote:
> I always think that FILE is stable public api and may have specific

The public interfaces you can pass FILE* to are a stable public API,
but the contents of the pointed-to object, or even whether FILE* is a
real pointer or just some other kind of opaque reference is completely
unspecified and a matter of implementation internals.
I understand.
> augmentation in various libc implementations/versions.
> I use musl libc 1.1.14. I need description all fields and how read,
> write an seek operates internally with them.

It's not clear what you want to do.

I want replace in my project  existing sscanf implementation in builtin libc by musl variant. I need understand how works FILE struct and use existing APIs defined in my system libc.

 If you just want to be able to
operate on the underlying file descriptor, you can use fileno() (a
standard public function) to get the fd number and use any of the
standard functions from unistd.h on it. However mixing use of the
stdio functions and direct operations on the fd will cause problems if
you don't observe some rules for switching between them.

musl also has some lightly abstracted functions for accessing normally
hidden parts of the stdio FILE state which were added (somewhat
reluctantly) to meed the needs of gnulib. They're declared in
stdio_ext.h and defined in src/stdio/ext.c and src/stdio/ext2.c. I
would not recommend using them in new programs (they're mainly for
legacy compatibility with gnulib) but if the alternative is poking at
the FILE structure yourself, they would be a better choice.

Rich

- - - ������ ���������������� ���������� ������������������ ���������������� "������������������" �� �������� "��������������" - - -



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-02-26  4:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-25 18:37 missing decription struct named FILE Fiodar
2016-02-25 18:46 ` Rich Felker
2016-02-25 19:36   ` Re[2]: [musl] " Fiodar
2016-02-25 19:52     ` Rich Felker
2016-02-26  4:54 fedor_qd

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).