New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to open a filedes and FILE* as SQFile* #108

Closed
wants to merge 1 commit into
base: spur64
from

Conversation

Projects
None yet
4 participants
@zecke
Contributor

zecke commented Sep 22, 2016

When using BSD/Linux/Posix APIs a filedescriptor will be returned from
the system. Make it possible to turn either a filedes or a FILE* into a
SQFile*. This can be used to read/write using the StandardFileStream and
its subclasses.

A simple test to open filedes '2' and write to it has worked. More
advanced modes are still missing.

@takano32

This comment has been minimized.

Show comment
Hide comment
@takano32

takano32 Sep 30, 2016

Contributor

@zecke Would you merge this PR for auto-merge?
zecke#1

Contributor

takano32 commented Sep 30, 2016

@zecke Would you merge this PR for auto-merge?
zecke#1

@zecke

This comment has been minimized.

Show comment
Hide comment
@zecke

zecke Sep 30, 2016

Contributor

What do you mean with automerge? I want to try similar changes into OpenSmalltalk first but there is some reluctance in adding anything to the FilePlugin...

Contributor

zecke commented Sep 30, 2016

What do you mean with automerge? I want to try similar changes into OpenSmalltalk first but there is some reluctance in adding anything to the FilePlugin...

@takano32

This comment has been minimized.

Show comment
Hide comment
@takano32

takano32 Sep 30, 2016

Contributor

@zecke Sorry, not auto-merge but pass-CI.
I've used 'auto-merge' as meaning for merging in GitHub Web interface.

This PR's CI Fails are now gone with merging trunk.
And merging trunk PR is zecke#1 .

screen shot 2016-09-30 at 19 06 48

Contributor

takano32 commented Sep 30, 2016

@zecke Sorry, not auto-merge but pass-CI.
I've used 'auto-merge' as meaning for merging in GitHub Web interface.

This PR's CI Fails are now gone with merging trunk.
And merging trunk PR is zecke#1 .

screen shot 2016-09-30 at 19 06 48

Allow to open a filedes and FILE* as SQFile*
When using BSD/Linux/Posix APIs a filedescriptor will be returned from
the system. Make it possible to turn either a filedes or a FILE* into a
SQFile*. This can be used to read/write using the StandardFileStream and
its subclasses.

A simple test to open filedes '2' and write to it has worked. More
advanced modes are still missing.
@takano32

This comment has been minimized.

Show comment
Hide comment
@takano32

takano32 Sep 30, 2016

Contributor

Thanks.
Now, this PR have passed CI.
And LGTM.

Contributor

takano32 commented Sep 30, 2016

Thanks.
Now, this PR have passed CI.
And LGTM.

@estebanlm estebanlm closed this Nov 28, 2016

@estebanlm

This comment has been minimized.

Show comment
Hide comment
@estebanlm

estebanlm Nov 28, 2016

Member

I will include this in the new master... once I can manage to have one :)

Member

estebanlm commented Nov 28, 2016

I will include this in the new master... once I can manage to have one :)

@marianopeck

This comment has been minimized.

Show comment
Hide comment
@marianopeck

marianopeck Nov 29, 2016

Contributor

Cool. Thanks Esteban. Could you please let us know here when a VM is finally released including this PR? Thanks!

Contributor

marianopeck commented Nov 29, 2016

Cool. Thanks Esteban. Could you please let us know here when a VM is finally released including this PR? Thanks!

estebanlm added a commit to estebanlm/pharo-vm that referenced this pull request Jan 12, 2017

Merge pull request #108 from estebanlm/Cog
enhance third-party libraries build + others

marianopeck added a commit to pharo-contributions/OSSubprocess that referenced this pull request May 16, 2017

IMPORTANT: This commit needs a bleeding edge Pharo VM Until now, I am…
… using the primCreatePipe from OSProcess because that would answer me directly the SQFiles of the pipe. Originally (before ending up doing that), I was trying to make the pipes myself via FFI ( pipe() ) but I came to the problem we discussed earlier ( the #name:attachTo:writable:).
Thanks to this PR in the VM: pharo-project/pharo-vm#108   we are now able to create the pipes ourselves and with the FD, create a SQFile. So..we now get rid of OSProcess primCreatePipe and related methods.  

Note that for this commit to work you must have a VM with the mentioned PR integrated.

@marianopeck marianopeck referenced this pull request Jun 23, 2017

Closed

Pharo 64bits support #22

@marianopeck

This comment has been minimized.

Show comment
Hide comment
@marianopeck

marianopeck Aug 22, 2017

Contributor

I think this PR was never integrated into the VM or it might have been lost. Can you confirm this please?

Contributor

marianopeck commented Aug 22, 2017

I think this PR was never integrated into the VM or it might have been lost. Can you confirm this please?

@zecke

This comment has been minimized.

Show comment
Hide comment
@zecke

zecke Aug 24, 2017

Contributor

It is open. The Squeak-VM devs were reluctant to add it but now we can habve cppIf... to have this pharo specific.

Contributor

zecke commented Aug 24, 2017

It is open. The Squeak-VM devs were reluctant to add it but now we can habve cppIf... to have this pharo specific.

@estebanlm

This comment has been minimized.

Show comment
Hide comment
@estebanlm

estebanlm Aug 24, 2017

Member

yes, this is the problem.
we need a "pharo-only" solution... now, some questions:

  1. can't this be done using UFFI?
  2. if not... can you make it work just for Pharo? (then I will merge it)
Member

estebanlm commented Aug 24, 2017

yes, this is the problem.
we need a "pharo-only" solution... now, some questions:

  1. can't this be done using UFFI?
  2. if not... can you make it work just for Pharo? (then I will merge it)
@zecke

This comment has been minimized.

Show comment
Hide comment
@zecke

zecke Aug 24, 2017

Contributor
  1. It can't be done right now and before doing major changes to the VM IO handling there should be some buy-in.

  2. For Pharo7 let's have the primitive. We can improve FileStream and Socket later.

Contributor

zecke commented Aug 24, 2017

  1. It can't be done right now and before doing major changes to the VM IO handling there should be some buy-in.

  2. For Pharo7 let's have the primitive. We can improve FileStream and Socket later.

@zecke

This comment has been minimized.

Show comment
Hide comment
@zecke

zecke Aug 24, 2017

Contributor

@estebanlm please re-open it.

Contributor

zecke commented Aug 24, 2017

@estebanlm please re-open it.

@estebanlm

This comment has been minimized.

Show comment
Hide comment
@estebanlm

estebanlm Aug 24, 2017

Member

I can't, this is against a branch that no longer exists.

Member

estebanlm commented Aug 24, 2017

I can't, this is against a branch that no longer exists.

@marianopeck

This comment has been minimized.

Show comment
Hide comment
@marianopeck

marianopeck Nov 23, 2017

Contributor

Looks like this PR was moved to this one: #142

Contributor

marianopeck commented Nov 23, 2017

Looks like this PR was moved to this one: #142

akgrant43 pushed a commit to akgrant43/opensmalltalk-vm that referenced this pull request Mar 1, 2018

21462-Open a FileStream based on fd or FILE*
Extend FilePlugin to allow a file to be opened using either the file
descriptor (fd) or FILE* in Pharo.

Original PR: pharo-project/pharo-vm#108
Updated PR: pharo-project/pharo-vm#142

(both superseeded)

As a (redundant) example of how this can be used, to open stderr (fd=2)
for writing:

| stderr |

stderr := BinaryFileStream handle: (FilePluginPrims new
    openFileDescriptor: 2 writable: true)
        file: (File named: 'fd2')
        forWrite: true

stderr nextPutAll: 'Hello World'; lf.
stderr close.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment