• Home
  • About

Saved searches

  • Remove
  • Verified account @
Suggested users
  • Verified account @
  • Verified account @
  • Language: English
    • Bahasa Indonesia
    • Bahasa Melayu
    • Català
    • Čeština
    • Dansk
    • Deutsch
    • English UK
    • Español
    • Filipino
    • Français
    • Hrvatski
    • Italiano
    • Magyar
    • Nederlands
    • Norsk
    • Polski
    • Português
    • Română
    • Slovenčina
    • Suomi
    • Svenska
    • Tiếng Việt
    • Türkçe
    • Ελληνικά
    • Български език
    • Русский
    • Српски
    • Українська мова
    • עִבְרִית
    • العربية
    • فارسی
    • मराठी
    • हिन्दी
    • বাংলা
    • ગુજરાતી
    • தமிழ்
    • ಕನ್ನಡ
    • ภาษาไทย
    • 한국어
    • 日本語
    • 简体中文
    • 繁體中文
  • Have an account? Log in
    Have an account?
    · Forgot password?

    New to Twitter?
    Sign up
By using Twitter’s services you agree to our Cookie Use and Data Transfer outside the EU. We and our partners operate globally and use cookies, including for analytics, personalisation, and ads.
johnregehr's profile
John Regehr
John Regehr
John Regehr
@johnregehr

John Regehr

@johnregehr

In Kentucky it's just FC

Joined September 2009
  • © 2016 Twitter
  • About
  • Help
  • Terms
  • Privacy
  • Cookies
  • Ads info
Dismiss
Previous
Next

Go to a person's profile

Saved searches

  • Remove
  • Verified account @
Suggested users
  • Verified account @
  • Verified account @

Retweet this to your followers?

Optional comment for Retweet
 
 

Saved searches

  • Remove
  • Verified account @
Suggested users
  • Verified account @
  • Verified account @
140

Are you sure you want to delete this Tweet?

Promote this Tweet

Block

  • Add a location to your Tweets

    When you tweet with a location, Twitter stores that location. You can switch location on/off before each Tweet and always have the option to delete your location history. Learn more

    Profile summary

    Your lists

    Create a new list


    Under 100 characters, optional

    Privacy

    Your reply includes the people in this conversation up to this point. Learn more

    Copy link to Tweet

    Embed this Tweet

    Embed this Video

    Add this Tweet to your website by copying the code below. Learn more

    Add this video to your website by copying the code below. Learn more

    Hmm, there was a problem reaching the server.

    Preview

    Log in to Twitter

    · Forgot password?
    Don't have an account? Sign up »

    Sign up for Twitter

    Not on Twitter? Sign up, tune into the things you care about, and get updates as they happen.

    Sign up
    Have an account? Log in »

    Two-way (sending and receiving) short codes:

    Country Code For customers of
    United States 40404 (any)
    Canada 21212 (any)
    United Kingdom 86444 Vodafone, Orange, 3, O2
    Brazil 40404 Nextel, TIM
    Haiti 40404 Digicel, Voila
    Ireland 51210 Vodafone, O2
    India 53000 Bharti Airtel, Videocon, Reliance
    Indonesia 89887 AXIS, 3, Telkomsel, Indosat, XL Axiata
    Italy 4880804 Wind
    3424486444 Vodafone
    » See SMS short codes for other countries

    Confirmation

     

    Buy Now

    Hmm... Something went wrong. Please try again.

    Previous Tweet
    John Regehr ‏@johnregehr 27 Apr 2015

    serious but undoubtedly stupid question: why does writing to file descriptor 0 in Linux and OS X work?

    • Retweet 1
    • Likes 4
    • Ben Rosengart scott vokes Saurabh Sharan zooko Jason Bucata
    10:46 AM - 27 Apr 2015
    1 retweet 4 likes
      1. chocolate hornet ‏@whitequark 27 Apr 2015

        @johnregehr stdin, stdout, stderr 0 1 2

        0 retweets 0 likes
      2. View other replies
      3. John Regehr ‏@johnregehr 27 Apr 2015

        @whitequark I know-- I'm asking why writing to stdin works

        0 retweets 1 like
      4. John Regehr ‏@johnregehr 27 Apr 2015

        @whitequark actually writing to stdin does not work (on my system at least) but writing to fd 0 does work

        0 retweets 1 like
      5. View other replies
      6. chocolate hornet ‏@whitequark 27 Apr 2015

        @johnregehr oh, WRITING it's /dev/pts/1 opened guess konsole or getty opens it as O_RDWR.

        0 retweets 0 likes
      7. John Regehr ‏@johnregehr 27 Apr 2015

        @whitequark I just find it odd that this program prints 1 line instead of 0 or 2 http://pastebin.com/EpCQbqDg 

        0 retweets 0 likes
      8. chocolate hornet ‏@whitequark 27 Apr 2015

        @johnregehr I guess FILE duplicates the open flags?

        0 retweets 0 likes
      9. chocolate hornet ‏@whitequark 27 Apr 2015

        @johnregehr I could look at glibc or wherever in the kernel fds happen but you'd need to motivate me to do that

        0 retweets 0 likes
      10. John Regehr ‏@johnregehr 27 Apr 2015

        @whitequark not so much interested in the implementation than the reasoning behind it

        0 retweets 0 likes
      11. Show more
      1. zing web creak ‏@elwoz 27 Apr 2015

        @johnregehr What is file descriptor 0 pointed at when this happens? I think I know the answer for the case it's a tty, but not otherwise.

        0 retweets 0 likes
      2. John Regehr ‏@johnregehr 27 Apr 2015

        @elwoz works the same when running "foo 0> output"

        0 retweets 0 likes
      3. View other replies
      4. zing web creak ‏@elwoz 27 Apr 2015

        @johnregehr In that case you should be able to write *but not read* stdin. If you can read it, that's a bug in your shell.

        0 retweets 0 likes
      5. John Regehr ‏@johnregehr 27 Apr 2015

        @elwoz can definitely read and write fd 0 in the same process (on my mac)

        0 retweets 0 likes
      6. zing web creak ‏@elwoz 27 Apr 2015

        @johnregehr If you can do that with "0>output", it's a bug in the shell.

        0 retweets 0 likes
      7. John Regehr ‏@johnregehr 27 Apr 2015

        @elwoz only works from console looks like

        0 retweets 0 likes
      8. View other replies
      9. zing web creak ‏@elwoz 27 Apr 2015

        @johnregehr OK, so that's the tty case I was thinking of. It was probably opened once, O_RDWR, then dup'ed onto 0/1/2.

        0 retweets 0 likes
      1. Robert Graham  ❄ ‏@ErrataRob 27 Apr 2015

        @johnregehr Isn't it the same as stdin? Why wouldn't writing to it work?

        0 retweets 0 likes
      2. View other replies
      3. John Regehr ‏@johnregehr 27 Apr 2015

        @ErrataRob but why should it work? should I also be able to read from stdout? where would the data that I get come from?

        0 retweets 0 likes
      4. Robert Graham  ❄ ‏@ErrataRob 27 Apr 2015

        @johnregehr The other end of the pipe. I don't know, but I assume the shell does the standard create pipe for each one, then fork(3)

        0 retweets 0 likes
      5. John Regehr ‏@johnregehr 27 Apr 2015

        @ErrataRob when I write pipe code I always close the "wrong" ends -- maybe bash authors don't agree...

        0 retweets 0 likes
      6. Robert Graham  ❄ ‏@ErrataRob 27 Apr 2015

        @johnregehr Write a test program that pipe/forks/execs another program that writes stdin and reads stdout....

        0 retweets 0 likes
      7. Robert Graham  ❄ ‏@ErrataRob 27 Apr 2015

        @johnregehr ...then see if closing the ends makes a difference.

        0 retweets 0 likes

    Loading seems to be taking a while.

    Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.

      Promoted Tweet

      false

      • © 2016 Twitter
      • About
      • Help
      • Terms
      • Privacy
      • Cookies
      • Ads info