{"id":115,"date":"2014-07-11T14:05:05","date_gmt":"2014-07-11T14:05:05","guid":{"rendered":"http:\/\/press3.mcs.anl.gov\/romio\/?p=115"},"modified":"2014-07-11T14:05:05","modified_gmt":"2014-07-11T14:05:05","slug":"more-headaches-with-2-gib-io","status":"publish","type":"post","link":"https:\/\/wordpress.cels.anl.gov\/romio\/2014\/07\/11\/more-headaches-with-2-gib-io\/","title":{"rendered":"More headaches with 2 GiB I\/O"},"content":{"rendered":"<p>There are quite a few headaches when updating ROMIO and MPICH to be 64 bit clean. Once you&#8217;ve gone through all the hurdles to promote types and squash that last overflowing integer parameter, you are not done yet!<br \/>\nTake a look at what happens on OS X (Darwin) when you pass 2147483648 (2<sup>31<\/sup>) bytes to the write system call:<br \/>\n<a title=\"Darwin Source Code\" href=\"http:\/\/opensource.apple.com\/source\/xnu\/xnu-2422.1.72\/bsd\/kern\/sys_generic.c\">http:\/\/opensource.apple.com\/source\/xnu\/xnu-2422.1.72\/bsd\/kern\/sys_generic.c<\/a><\/p>\n<pre>dofilewrite(vfs_context_t ctx, struct fileproc *fp, user_addr_t bufp, user_size_t nbyte, off_t offset, int flags,user_ssize_t *retval)\n{\n    uio_t auio;\n    long error = 0;\n    user_ssize_t bytecnt;\n    char uio_buf[ UIO_SIZEOF(1) ];\n    if (nbyte &gt; INT_MAX)\n        return (EINVAL);\n    ...\n}<\/pre>\n<p>It&#8217;s entirely within the standard for write or read to return less than<br \/>\nrequested, but this is not what darwin is doing: it&#8217;s straight-out erroring.<br \/>\nFreeBSD 9.2 and 10.0 exhibit similar behavior, which you can see in <a href=\"http:\/\/fxr.watson.org\/fxr\/source\/kern\/sys_generic.c?v=FREEBSD10;im=excerpts#L365\">sys\/kern\/sys_generic.c <\/a><\/p>\n<pre>int\nsys_read(td, uap)\n        struct thread *td;\n        struct read_args *uap;\n{\n        struct uio auio;\n        struct iovec aiov;\n        int error;\n        if (uap-&gt;nbyte &gt; IOSIZE_MAX)\n                return (EINVAL);\n        ...<\/pre>\n<p>So in commit <a href=\"http:\/\/git.mpich.org\/mpich.git\/commit\/5b674543ac\">5b674543<\/a> I simply ensure no write is larger than a signed 32 bit integer can hold.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are quite a few headaches when updating ROMIO and MPICH to be 64 bit clean. Once you&#8217;ve gone through all the hurdles to promote types and squash that last overflowing integer parameter, you are not done yet! Take a look at what happens on OS X (Darwin) when you pass 2147483648 (231) bytes to &hellip;<\/p>\n","protected":false},"author":362,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":"","_members_access_role":[],"_members_access_error":""},"categories":[2],"tags":[],"class_list":["post-115","post","type-post","status-publish","format-standard","hentry","category-development"],"acf":[],"_links":{"self":[{"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/posts\/115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/comments?post=115"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/posts\/115\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/media?parent=115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/categories?post=115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.cels.anl.gov\/romio\/wp-json\/wp\/v2\/tags?post=115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}