KASTURI VENKATA SESHA SASIDHAR
2007-Dec-16 05:31 UTC
[zfs-discuss] /usr/bin and /usr/xpg4/bin differences
Hello, I am working on open solaris bugs .. and need to change the code of df in the above two folders.. I would like to know why there are two df''s with diff options in the respective folders.. /usr/bin/df is different is from /usr/xpg4/bin/df!! Why is it so?? What is this xpg4 represent? Thanks, Sasidhar. This message posted from opensolaris.org
Hi, It''s a different version in terms of the Unix standard it complies to: http://docs.sun.com/app/docs/doc/816-5221/6mbcm38u8?l=en&a=view On 12/16/07, KASTURI VENKATA SESHA SASIDHAR <sasidhar.kvs at gmail.com> wrote:> Hello, > I am working on open solaris bugs .. and need to change the code of df in the above two folders.. > > I would like to know why there are two df''s with diff options in the respective folders.. > /usr/bin/df is different is from /usr/xpg4/bin/df!! > > Why is it so?? What is this xpg4 represent? > > > Thanks, > Sasidhar. > > > This message posted from opensolaris.org > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss >-- _________________________________/ sengork.blogspot.com /????
On Dec 15, 2007 11:31 PM, KASTURI VENKATA SESHA SASIDHAR <sasidhar.kvs at gmail.com> wrote:> Hello, > I am working on open solaris bugs .. and need to change the code of df in the above two folders.. > > I would like to know why there are two df''s with diff options in the respective folders.. > /usr/bin/df is different is from /usr/xpg4/bin/df!!The code for both variants of df come from the same source (usr/src/cmd/fs.d/df.c). The xpg4 variant is compiled with -DXPG4. After a build in usr/src/cmd/fs.d is complete you will see the following: $ ls df* df df.o df.po.xpg4 df.xpg4 df.c df.po df.xcl df.xpg4.o It looks to me as though df becomes /usr/bin/df and df.xpg4 becomes /usr/xpg4/bin/df. -- Mike Gerdts http://mgerdts.blogspot.com/
On Dec 16, 2007 1:16 AM, Sasidhar Kasturi <sasidhar.kvs at gmail.com> wrote:> Yes .. but have a look at the bug i am working on .. > Bug id:6493125 > > http://bugs.opensolaris.org/view_bug.do?bug_id=6493125 > > Thank you, > Sasidhar.I''m not sure what question you are asking... 1) Why are there two variants of df? If this is the question, it is likely because Solaris already had df that had some behavior that people had grown to depend on. A standards committee came along and said "We need the -P and -v option and the formatting of these headers needs to be ... and these columns needs to be like ...". Sun needed to not disrupt existing customers and needed XPG4 compliance to satisfy a potentially different set of customers. Thus, the XPG4 variant got some small changes that (at the time?) weren''t appropriate for the traditional version. There is some likelihood that the bug you are working on is not the first time that the differences between the XPG4 variant and the /usr/bin variant have decreased. 2) How could the same source code produce different output? It looks as though enabling the -P option is pretty straightforward - modification of the getopts() string at removal of the #ifdef at line 593 and getting rid of the #ifdef and corresponding #endif at lines 605 and 607 should be sufficient. 590 #ifdef XPG4 591 while ((arg = getopt(argc, argv, "F:o:abehkVtgnlPZ")) != EOF) { 592 #else 593 while ((arg = getopt(argc, argv, "F:o:abehkVtgnlvZ")) != EOF) { 594 #endif 595 if (arg == ''F'') { 596 if (F_option) 597 errmsg(ERR_FATAL + ERR_USAGE, 598 "more than one FSType specified"); 599 F_option = 1; 600 FSType = optarg; 601 } else if (arg == ''V'' && ! V_option) { 602 V_option = TRUE; 603 } else if (arg == ''v'' && ! v_option) { 604 v_option = TRUE; 605 #ifdef XPG4 606 } else if (arg == ''P'' && ! P_option) { 607 SET_OPTION(P); 608 #endif Of course, updating the usage error, man page, etc. would be appropriate too. You can see a few other "#ifdef XPG4" blocks that show the quite small differences between the two variants. Also... since there is nothing zfs-specific here, opensolaris-code may be a more appropriate forum. -- Mike Gerdts http://mgerdts.blogspot.com/
KASTURI VENKATA SESHA SASIDHAR wrote:> Hello, > I am working on open solaris bugs .. and need to change the code of df in the above two folders.. > > I would like to know why there are two df''s with diff options in the respective folders.. > /usr/bin/df is different is from /usr/xpg4/bin/df!! > > Why is it so?? What is this xpg4 represent?"man XPG4" ;) Rob++ -- |Internet: windsor at warthog.com __o |Life: Rob at Carrollton.Texas.USA.Earth _`\<,_ | (_)/ (_) |"They couldn''t hit an elephant at this distance." | -- Major General John Sedgwick