• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: select() and svn 1.5 [partially solved]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: select() and svn 1.5 [partially solved]


  • Subject: Re: select() and svn 1.5 [partially solved]
  • From: Luke Daley <email@hidden>
  • Date: Wed, 3 Sep 2008 00:08:28 +1000


On 02/09/2008, at 11:38 PM, Jean-Daniel Dupas wrote:


Le 2 sept. 08 à 14:58, Luke Daley a écrit :


On 02/09/2008, at 10:18 PM, Jean-Daniel Dupas wrote:

» nm /usr/lib/libSystem.dylib | grep __syscall
000441d0 t ___syscall

It's very clearly there, why can't my code find it?

Because it is an internal symbol and it is not exported (note the lower case 't' in front of the symbol name).


Hrm. I have to call it, what do I do?

As you are already using interposition, another feature that should be avoid will not hurt ;-)


#include <libc.h>
#include <mach-o/nlist.h>

typedef int (*__syscall_t)(quad_t number, ...);

int main(int argc, const char * argv[]) {
struct nlist nl[1];
bzero(&nl, sizeof(struct nlist) * 2);
nl[0].n_un.n_name = (char *)"___syscall";
if (nlist("/usr/lib/libSystem.dylib", nl) < 0 || nl[0].n_type == N_UNDF) {
fprintf(stderr, "nlist(%s, %s) failed\n",
"/usr/lib/libSystem.dylib",
nl[0].n_un.n_name);
return -1;
}
__syscall_t fcn = (__syscall_t)nl[0].n_value;


  return 0;
}


See man nlist(3) for details.

Wow, scary :)

I think there might be a problem with it though. I get "error: ‘union <anonymous>’ has no member named ‘n_name’"

Looking at nlist.h…

struct nlist {
	union {
#ifndef __LP64__
		char *n_name;	/* for use when in-core */
#endif
		int32_t n_strx;	/* index into the string table */
	} n_un;
	uint8_t n_type;		/* type flag, see below */
	uint8_t n_sect;		/* section number or NO_SECT */
	int16_t n_desc;		/* see <mach-o/stab.h> */
	uint32_t n_value;	/* value of this symbol (or stab offset) */
};

Does that mean that  n_name doesn't exist on 64 bit architectures?

--

LD.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: select() and svn 1.5 [partially solved] (From: Luke Daley <email@hidden>)
 >Re: select() and svn 1.5 [partially solved] (From: Jean-Daniel Dupas <email@hidden>)
 >Re: select() and svn 1.5 [partially solved] (From: Luke Daley <email@hidden>)
 >Re: select() and svn 1.5 [partially solved] (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Re: select() and svn 1.5 [partially solved]
  • Next by Date: change darwin ports
  • Previous by thread: Re: select() and svn 1.5 [partially solved]
  • Next by thread: change darwin ports
  • Index(es):
    • Date
    • Thread