НА: НА: НА: Smoke [ebcdic] v5.21.8-419- gaa57d5a FAIL(X) os/390 23.00 (2817/)

[email protected] (Yaroslav Kuzmin)
Newsgroups perl.mvs,perl.perl5.porters
Message-ID <[email protected]>
> If I had been thinking, I would have realized that.  Attached is a
> revised file, that I hope works for you.  It won't compile on my system
> since things are different here.

> The difference is that your system has an element in the DIR structure
> called dd_fd which should contain the same information as what dirfd()
> returns.

> If it doesn't compile, maybe you could tweak it so it does.


(00:38) RS12 : PDKUZM | ~/ussport/perl/test :>
(00:38) RS12 : PDKUZM | ~/ussport/perl/test :> c99 -qlanglvl=extended:extc89:extc99 -qlongname -qxplink -qdll  -DOEMVS  -D_XOPEN_SOURCE_EXTENDED -D_ALL_SOURCE -D_POSIX_SOURCE=1 -c stat.c -o stat.o
(00:38) RS12 : PDKUZM | ~/ussport/perl/test :> c99 -qxplink -qdll -o stat stat.o
(00:38) RS12 : PDKUZM | ~/ussport/perl/test :> ./stat
fstat: EDC5113I Bad file descriptor. (errno2=0x053A0090)
(00:38) RS12 : PDKUZM | ~/ussport/perl/test :>

I do not know why he gives out "Bad file descriptor" :)

But to fill the structure stat for directory can use function stat :

output attached file

(00:56) RS12 : PDKUZM | ~/ussport/perl/test :>
(00:59) RS12 : PDKUZM | ~/ussport/perl/test :> c99 -qlanglvl=extended:extc89:extc99 -qlongname -qxplink -qdll  -DOEMVS  -D_XOPEN_SOURCE_EXTENDED -D_ALL_SOURCE -D_POSIX_SOURCE=1 -c stat.c -o stat.o
(00:59) RS12 : PDKUZM | ~/ussport/perl/test :> c99 -qxplink -qdll -o stat stat.o
(00:59) RS12 : PDKUZM | ~/ussport/perl/test :> ./stat
 :> 3
fstat: EDC5113I Bad file descriptor. (errno2=0x053A0090)
Success : stat
(00:59) RS12 : PDKUZM | ~/ussport/perl/test :>


------------------------------------------------------------------------
 Yaroslav Kuzmin
Developer C/C++ ,z/OS , Linux
3 Zhukovskiy Street · Miass, Chelyabinsk region 456318 · Russia
Tel:  +7.922.2.38.33.38
Email: [email protected]
Web: www.rocketsoftware.com

================================
Rocket Software, Inc. and subsidiaries ■ 77 Fourth Avenue, Waltham MA 02451 ■ +1 800.966.3270 ■ +1 781.577.4321
Unsubscribe From Commercial Email – [email protected]
Manage Your Subscription Preferences - http://info.rocketsoftware.com/GlobalSubscriptionManagementEmailFooter_SubscriptionCenter.html
Privacy Policy - http://www.rocketsoftware.com/company/legal/privacy-policy
================================

This communication and any attachments may contain confidential information of Rocket Software, Inc. All unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify Rocket Software immediately and destroy all copies of this communication. Thank you.
stat_dir.c (text/x-csrc, 699 B)
#include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#ifdef I_STDLIB
#include <stdlib.h>
#endif

int main(int argc, char *argv[])
{
    DIR *stream;
    struct stat stat_buf;
    errno = 0;
    if (! (stream = opendir("."))) {
        perror("opendir");
    }
    else {
        errno = 0;
				fprintf(stderr," :> %d\n",stream->dd_fd);
        if (fstat(stream->dd_fd, &stat_buf) == -1) {
            perror("fstat");
        }
        else {
            fprintf(stderr,"Success : fstat\n");
        }
    }
		if(stat(".",&stat_buf) == -1){
			perror("stat");
		}
		else{
			fprintf(stderr,"Success : stat\n");
		}
		return 0;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.